[erlang-questions] Design question -- a valid or foolhardy approach to ets update?

Mihai Balea <>
Tue Jul 14 15:30:19 CEST 2009


On Jul 14, 2009, at 8:07 AM, Steve Davis wrote:

> Hi Mihai -
>
> Wow. That is the perfect solution.
>
> Since update_counter ensures the update will be atomic... well,  
> that's just exactly the right thing to do.

Just be aware that atomic updates means that updates will still be  
serialized - you will still run into a concurrency bottleneck since  
the operation will prevent any other access to the table while it is  
in progress. It will probably be faster than the gen_server solution,  
but still not a fully concurrent approach.

I'm not even sure a fully concurrent solution is possible with ets  
tables. You will probably have to encapsulate session ids in processes  
to do that... which will significantly increase your memory footprint  
and transaction latency, but will scale better.

I would suggest you try update_counter first and if it turns out it is  
indeed a bottleneck, then go for a fancier approach.

Mihai




More information about the erlang-questions mailing list