gen_server with a dict vs mnesia table vs ets

Pablo Platt pablo.platt@REDACTED
Thu Jan 28 14:00:39 CET 2010


Hi,
I'm building an erlang server.
Users sends http requests to the server to update their status.
The http request process on the server saves the user status message in 
memory.
Every minute the server sends all messages to a remote server and clear 
the memory.
If a user update his status several times in a minute, the last message 
overrides the previous one.
It is important that between reading all the messages and clearing them 
no other process will 
be able to write a status message.
What is the best way to implement it?
	1. gen_server with a dict. The key will be the userid. dict:store/3 
will update or create the status. The gen_server solves the 
'transaction' issue.
	2. mnesia table with ram_copies. Handle transactions and I don't 
need to implement a gen_server. Is there too much overhead with this 
solution?
	3. ETS table which is more light weight and have a gen_server. Is it possible to do the transaction in ETS? To lock the table between 
reading all the messages and clearing them?
Thanks


      


More information about the erlang-questions mailing list