[erlang-questions] Request for opinions on using process dictionary for meta information

Roger Lipscombe <>
Tue Apr 18 11:44:54 CEST 2017


On 18 April 2017 at 10:29, Gianfranco Alongi <>
wrote:

> Hi!
>
> It kind of sounds similar to the idea behind gproc, which is a widely used
> library,
> so as everyone has said already - this is perfectly fine.
>
> https://github.com/uwiger/gproc
>

Doesn't gproc store the process metadata in an ETS table? That's a valid
approach, too, but you need a monitor process to clean up if the process
dies.
As another pro-example of storing information in the process dictionary;
this is what lager does with metadata -- see lager:md.

Both approaches are valid: we use all of the following:

1. Process dictionary (usually for lager, but sometimes separately).
2. Separate process registry using one or more ETS tables (we don't use
gproc; we wanted slightly different semantics).
3. Process responds to gen_server:call(Pid, info)

They're useful for different information, for different scenarios.

I'd be reluctant to use the process dictionary for anything other than
process-internal-use or debugging information, though.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20170418/85763848/attachment.html>


More information about the erlang-questions mailing list