Have you consider prototyping this in mnesia, it would give you everything out of the box for something this simple.
Obviously you could build your own leveraging ets, global and etc. but feels like mnesia would be a better fit for this. Just my 50 cent after a cursory read.
There are also atomics — OTP 29.0.2 (erts 17.0.2) and counters — OTP 29.0.2 (erts 17.0.2)
Anyways, my recommendation is always to look into OTP with these kind of questions, since they likely have been solved before! Best of luck!






















