<div dir="ltr"><div class="gmail_extra">It is a pity, but this advice is not enough:</div><div class="gmail_extra"><br></div><div class="gmail_extra">> Just use synchronous OTP calls in gen_* behaviours for all desirable interactions</div><div class="gmail_extra"><br></div><div class="gmail_extra">If you have a HTTP API that sends gen_server:call to some process, then you can get into a storm situation:</div><div class="gmail_extra"><br></div><div class="gmail_extra">1) client comes to HTTP</div><div class="gmail_extra">2) http handler makes gen_server:call to singleton server</div><div class="gmail_extra">3) waits for 5 or 60 seconds and then exits, but message is already in process queue</div><div class="gmail_extra">4) server fetches this useless message from mailbox and starts making useless expensive operations</div><div class="gmail_extra">5) meanwhile client makes another duplicate request and again fills singleton mailbox with the same request</div><div class="gmail_extra"><br></div><div class="gmail_extra"><br></div><div class="gmail_extra">It is a dangereous situation and sometimes it is required to look at gen_server message_queue_len before calling it, but</div><div class="gmail_extra">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.</div><div class="gmail_extra"><br></div><div class="gmail_extra"><br></div></div>