[erlang-questions] Sender punishment removed

Max Lapshin max.lapshin@REDACTED
Tue Jan 23 11:30:19 CET 2018


It is a pity, but this advice is not enough:

> Just use synchronous OTP calls in gen_* behaviours for all desirable
interactions

If you have a HTTP API that sends gen_server:call to some process, then you
can get into a storm situation:

1) client comes to HTTP
2) http handler makes gen_server:call to singleton server
3) waits for 5 or 60 seconds and then exits, but message is already in
process queue
4) server fetches this useless message from mailbox and starts making
useless expensive operations
5) meanwhile client makes another duplicate request and again fills
singleton mailbox with the same request


It is a dangereous situation and sometimes it is required to look at
gen_server message_queue_len before calling it, but
if you do it on a multicore machine, you get into  lock contention and you
will see low CPU and low RPS with high locks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20180123/ae11db4e/attachment.htm>


More information about the erlang-questions mailing list