[erlang-questions] erlang:send_after/3 questions

Bryan bryan@REDACTED
Mon Jan 12 20:54:15 CET 2015


Hi Gleb,

Hope you don’t mind me digging up this thread, but I was wondering if you could ask you a few questions based on your experience as we are looking at a similar situation where we have 500k (or more) processes active on a single node. Each process kicks off a couple of long running timers using erlang:send_after with dest being self(). We haven’t hit any slowdowns yet, but I am curious to understand your experience better. 

Were you using erlang:send_after or the timer module?

How did you eventually resolve your problem with the locking? Did you have to redesign how you were using the 3 to 5 timers per process so the total number of timers was reduced, or did you do something else, such as stagger the timers so they were not all firing at the same time?

Thanks in advance!

Cheers,
Bryan

----

Bryan Hughes
 Go Factory

http://www.go-factory.net

> On Sep 22, 2012, at 1:06 AM, Gleb Peregud <gleber.p@REDACTED> wrote:
> 
> In my experience, using excessive timers once bit me hard due to lock contention on global timers lock in Erts. Roughly it was about 3-5 timers created/expired for each of around 200k-500k processes at roughly the same moment (a big broadcast to all processes). Fortunately lcnt showed the problem which was slowing down the broadcast tenfold - lock conflicts was at 95% level on timers lock.
> 
> On Sep 22, 2012 8:07 AM, "Rapsey" <rapsey@REDACTED <mailto:rapsey@REDACTED>> wrote:
> 
> 3. Is spawning a lot of send_after's or timers a dangerous idea? In case of using timer module, we'll just lose some started timers due to port restart. But something tells me that crash of erlang internal timers is a somewhat more dangerous thing that might even crash the VM.
> 
> How much is a lot of send_afters? My server runs a lot of timers, but very rarely in more than one per process. But there can easily be thousands of timers running in different processes.
> I would advise against using timer module. Using the timer module in a few places turned out to be a big mistake. It sometimes just stops working completely. It may be a mistake on my part, but erlang:send_after generally does everything you need and is completely reliable.
> 
> 
> Sergej 
> 
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED <mailto:erlang-questions@REDACTED>
> http://erlang.org/mailman/listinfo/erlang-questions <http://erlang.org/mailman/listinfo/erlang-questions>
> 
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20150112/d60db35f/attachment.htm>


More information about the erlang-questions mailing list