implications of keeping many erlang terms in the state of a gen_server

Pablo Platt pablo.platt@REDACTED
Tue May 11 14:40:41 CEST 2010


Hi,

I'm trying to understand if its ok to have a large number of erlang terms in the state of a gen_server.
I'll have ~10K gen_servers running each with a state, a record, with several erlang terms.
The state will also have ~5 lists each with ~100 erlang terms.
The gen_server will need to add items to the head of the list and to pass the whole list but not random access.
The gen_server will be accessed every 1 minute so I don't think hibernate should be used.

What are the costs of keeping a lot of erlang terms in the state?
Are there cpu or memory costs except for the actual size of the elements?
What are the costs of garbage collection and how often does it happens?
Are there costs every time the gen_server is being called?
Is there a difference between passing the whole state around in functions (in the same processes)  and just passing a small part of the state?
Is there a difference between changing the state several times in the same function and changing it once?

Thanks


      


More information about the erlang-questions mailing list