问题
There is an application on the Phoenix Framework.
There is a need for GenServer, which will check some values.
Validation of these values is started from the controller (a request comes from the client, the GenServer value checks, the client receives a response).
Once handle_call is synchronous, then what happens when 10 clients call 10 calls handle_call at a time? All 10 calls will be processed in parallel or in the order of the queue?
回答1:
GenServer will process only single call other messages will be queued in mailbox. You can allow this if there is need for synchronous process but you have to think about mailbox, it could pile up soon on heavier load and kill VM probably without any warning.
Did you consider using Task instead?
来源:https://stackoverflow.com/questions/45526514/elixir-genserver-parallel-handle-call