Each Erlang process supports a message queue. The process will receive the message and process the messages one by one.
In your example, if two clients call gen_server
at the same time, these calls will become a message in the queue of the gen_server
process, and gen_server
will process these messages one by one. Therefore, no need to worry about conflict.
But if one process needs to process too many messages from other processes, you need to think about the capacity of the process and optimize the design, otherwise it will become a bottleneck.
source share