[erlang-questions] Erlang processes and state management design

KatolaZ me@REDACTED
Wed Oct 24 13:05:15 CEST 2007


On Wed, Oct 24, 2007 at 12:00:31PM +0200, Alexander Lamb wrote:
>
> Therefore, I have a question: where is it usuall or reasonnable to keep the 
> state of a process?
>
> 1) in the parameters of the function we spawn
> 2) in the process dictionnary
> 3) in an ETS structure
> 4) in a in-memory mnesia structure

All those solutions imply to have the process on the server side 
running for the whole duration of a session. If the process crashes, 
you loose the state, and all other stuff. 

This is not the exact replacement of what happens with sessions in
PHP, where the state (session variables) are usually stored into a
file or into a DB. 

Let's put it this way: a web application is one of the few exceptions
to the usually-working golden rule: "always avoid side effects and
state-related operations that can survive a process death".

This is basically why I sometimes use dets tables for web-based
erlang applications. They're somehow fast and performant and exactly 
surrogate PHP or Python sessions. 

HND

Enzo

-- 
[ Enzo Nicosia aka KatolaZ --- GLUG Catania -- Freaknet Medialab ]
[ me [at] katolaz.homeunix.net -- http://katolaz.homeunix.net -- ]
[ GNU/Linux User:#325780/ICQ UIN: #258332181/GPG key ID 0B5F062F ]
[ Fingerprint: 8E59 D6AA 445E FDB4 A153 3D5A 5F20 B3AE 0B5F 062F ]



More information about the erlang-questions mailing list