3 ms·
My particular problem was a back end for a medium-level multiplayer RPG (500ish people connected at once per world). The only real way I found to get it perfor
by bcrosby95 6y ago
My particular problem was a back end for a medium-level multiplayer RPG (500ish people connected at once per world). The only real way I found to get it performant was to lean heavily into processes. But then you have a race condition problem and need to DIY your own method of synchronization because you're no longer using the process mailbox for that purpose.
In practice I haven't found the immutability of Elixir that useful for concurrency because data is deep copied when it goes across processes anyways. This is in comparison to Clojure where you can safely and perfomantly share immutable data across multiple threads.
- dnautics 6y agoI would have suggested ets tables + entity system.
- bcrosby95 6y agoFrom my testing, the performance characteristics of ets isn't that great - data still gets copied around when you access stuff in it. I tried using it in my exploratory tests and certain worst case, player-focused actions would take around 20ms, when using a regular GenServer with a synchronization system on top would take around 5us. To be clear, for NPCs it worked fine. But players are hoarders and in an RPG that can result in a ridiculous amount of data being attached to them.