Hello Hazim,
Things will definitely start getting hairy when the page context gets
that huge. If you intend on using such a heavy amount of state data
such as you have, it may become more relevant to store that
information into custom state handler which only stores most of that
data on the server, and have it expire after some amount of time. The
nature of the standard state handler is to transfer the entire state
value from client to server and back with each request, that way
nothing has to be stored server-side to track it - the drawback comes
in that if that state is loaded with data, that you're transferring a
ton of data back and forth with each request.
You could make your own custom state handler that stored the data in a
cache of sorts, then provide a fallback for if the cache's TTL went
stale, you can regenerate it, then the only thing you need to store in
the actual state value that gets transferred from client to server is
a simple reference (like erlang:make_ref) as the key for the state
data.
You could almost certainly just copy the default session handler and
make a few changes to control the timeout.
If you look at the current state handler:
https://github.com/nitrogen/nitrogen_core/blob/master/src/handlers/state/default_state_handler.erl
..you'll see it's just a basic proplist that gets stored.
Whereas with the session handler:
https://github.com/nitrogen/nitrogen_core/blob/master/src/handlers/session/simple_session_handler.erl
...you'll see that in the get_session_pid function
(
https://github.com/nitrogen/nitrogen_core/blob/master/src/handlers/session/simple_session_handler.erl),
it fires up a process with the process registry handler that serves as
a simple server for a key-value lookup also using a basic list, and
specifies a timeout from the config (which you could set to whatever
you want).
This could very well be the ideal solution for you, though it
undoubtedly will use more memory on the server, since all users' will
have to stored server-side rather than client side, but it'll give you
a better response time, that's for sure.
If you have any questions, let me know.
-Jesse
> --
> You received this message because you are subscribed to the Google Groups
> "Nitrogen Project / The Nitrogen Web Framework for Erlang" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
nitrogenweb...@googlegroups.com.
> To post to this group, send email to
nitro...@googlegroups.com.
> Visit this group at
http://groups.google.com/group/nitrogenweb.
> For more options, visit
https://groups.google.com/d/optout.
--
Jesse Gumm
Owner, Sigma Star Systems
414.940.4866 ||
sigma-star.com || @jessegumm