3 ms·
Great strategy, I love how elegant it is, but I do wonder about two things regarding this method: Testing it (especially with async integration/e2e tests, whic
by dnautics 6y ago
Great strategy, I love how elegant it is, but I do wonder about two things regarding this method:
Testing it (especially with async integration/e2e tests, which I prefer) would be tricky, I'd want some tests to verify that the "GenServer write cache" is more or less counting correctly under some (potentially stressful) scenarios that I can stress out by having other things run in the VM.
From what's presented, I'm not sure yet how to get this to work with distribution, in the case that you would want to drop this into a distributed phoenix setting. Do you start the pages :global instead of registered? Do you start a Registry with :global, and have the cluster restart it if vm that hosts it dies?
- bigbassroller 6y agoI am not an expert at distributed systems with Elixir/Phoenix, but would Mnesia (https://en.m.wikipedia.org/wiki/Mnesia https://en.m.wikipedia.org/wiki/Mnesia) solve that problem?
- jansommer 6y agoRabbitMQ also made Ra[0], an Erlang implementation of Raft[1] [0] https://github.com/rabbitmq/ra https://github.com/rabbitmq/ra [1] https://raft.github.io/ https://raft.github.io/
- josevalim 6y agoDistribution is not necessary. Each server/node will have its own set of processes doing upserts, which are atomic. The testing story from Elixir is relatively straight-forward too. I send a bunch of requests and then ask the supervisor to shutdown, which forces all processes to terminate and perform their pending writes.
- dnautics 6y ago> Each server/node will have its own set of processes doing upserts, which are atomic. Perfect! thank you for clarifying. Or maybe i should have read it more carefully. > The testing story I keep forgetting ExUnit's start_supervised! exists.