Clone this wiki locally
Introduction to Gproc
(For a more detailed background, see this paper from the ACM SIGPLAN Erlang Workshop 2007)
Gproc came about as an attempt to create a searchable index of resources in large Erlang systems.
In Ericsson’s Voice over IP gateway applications, we found that developers ended up writing many different
types of mapping in order to find the right process, e.g.
- all processes handling sessions on a given outgoing link
- all processes related to a particular Call ID
- all processes with a particular function (e.g. all session handling processes)
In some cases, the process registry could have been used, had it only supported complex Erlang terms,
but since dynamically creating “structured” atoms was not an alternative, other mapping structures had
to be invented.
Gproc was created as to replace these structures with one generic index. We identified two major types of resource:
- Unique resources, which identify a single process. Gproc calls them names
- Non-unique resources, identifying a group of processes. Gproc calls them properties
Since counters are ubiquitous in Telecoms, we added them too. Counters are like properties, but have a numeric
‘value’, which can be atomically incremented, similarly to `ets:update_counter/3`.