Elixir GenServer parallel handle_call

≡放荡痞女 提交于 2020-01-04 06:50:10

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!