[erlang-questions] Private ets table vs. Process directory
Charles Hixson
charleshixsn@REDACTED
Wed Feb 7 17:56:01 CET 2018
When should a private ets table be preferred over the process directory?
To give some context, I'm expecting to has nearly as many processes as I
can run, and that each one will need internal mutable state. Also, that
the mutable state will be complex (partially because of the limited
number of processes), so passing the state as function parameters would
entail huge amounts of copying. (Essentially I'd be modifying nodes
deep within trees.)
Mutable state would allow me to avoid the copying, and the state is not
exported from the process. I'm concerned that a huge number of private
ets tables would use excessive memory, decreasing the number of
processes I could use...but all the references keep saying not to use
the process directory.
I'm still designing things now, so this is the ideal time to decide. An
alternative is that I could use a single public ets table, with each
process only accessing its own data, but I suspect that might involve a
lot of locking overhead, even though in principle nothing should need to
be locked.
More information about the erlang-questions
mailing list