[erlang-questions] ets vs process-based registry + local vs global dispatch

Ulf Wiger <>
Wed Jul 8 20:12:53 CEST 2009


Dave Smith wrote:
> You might want to look at Ulf Wiger's "proc" app -- I think it's
> already solved this problem (at least within the scope of a single
> node).
> 
> My github clone of it is here: http://github.com/dizzyd/proc/tree/master
> 
> Originally found in: http://jungerl.sourceforge.net/

Perhaps even better to look at gproc at
http://svn.ulf.wiger.net/gproc/

In the paper (found in the doc/ directory) I have some
benchmark figures, which among other things illustrate that
global is very slow. Ets is faster than dict, gb_trees, etc.
esp in this case, where the registry is kept by a central
server anyway, and the objects stored are small.

At least, this is the conventional wisdom. If the access
patterns to the ETS table include many processes, and the
system is running on multi-core, I'd say ETS performance is
a moving target. The new concurrency support for ETS added
in R13B01 may improve matters for an application like gproc,
but I don't know how much. I chose ETS mainly because I wanted
to use the select() behaviour for extracting sets of names.

At Ericsson, we found it fast enough for our purposes, but
for processes that register many shared attributes, it's a
very good idea to register them in bulk, rather than going
to the server once for every attribute.

BR,
Ulf W


> 
> Somewhere, I think Ulf has a SVN repo as well -- but can't remember where.
> 
> D.
> 
> On Wed, Jul 8, 2009 at 11:53 AM, Joel Reymont<> wrote:
>> Are there any performance numbers on using ETS to keep track of processes vs
>> using a process-based registry? What about local vs global gen_server casts?
>>
>> I'm keeping track of processes associated with session tokens. I can
>> globally register a process with a name that includes any term. I can only
>> use an atom when registering a process locally.
>>
>> I suspect that sending messages to globally registered processes ({global,
>> {client_proxy, Token}}) is slowing me down quite a bit. I'm thinking of
>> keeping processes in a token->pid map but I'd like to know if ETS is
>> generally recommended over a process wrapping a dict or gb_tree map.
>>
>> I'm going to run tests and get some hard numbers. I'm wondering if there's
>> an existing body of knowledge on this, though.
>>
>>        Thanks, Joel
>>
>> ---
>> Mac hacker with a performance bent
>> http://www.linkedin.com/in/joelreymont
>>
>>
>> ________________________________________________________________
>> erlang-questions mailing list. See http://www.erlang.org/faq.html
>> erlang-questions (at) erlang.org
>>
>>
> 
> ________________________________________________________________
> erlang-questions mailing list. See http://www.erlang.org/faq.html
> erlang-questions (at) erlang.org
> 


-- 
Ulf Wiger
CTO, Erlang Training & Consulting Ltd
http://www.erlang-consulting.com


More information about the erlang-questions mailing list