[erlang-questions] fire off a task via erlang

Evans, Matthew mevans@REDACTED
Thu May 13 17:34:20 CEST 2010


You could certainly use the timer module. But there is a small performance overhead.

Maybe a better choice would be each task to be its own gen_server and use erlang:send_after(Delay,self(),Message).

IRC that has a lower overhead. You would call the first instance of send_after in the init function, and then the message would be caught by handle_info, where you restart the timer.

Matt

-----Original Message-----
From: erlang-questions@REDACTED [mailto:erlang-questions@REDACTED] On Behalf Of Wes James
Sent: Thursday, May 13, 2010 11:30 AM
To: erlang-questions@REDACTED
Subject: [erlang-questions] fire off a task via erlang

Yesterday some colleagues were talking about "how they would keep
track of possibly millions of tasks that would need to be fired off on
a given interval that users could select."  I.e, they were discussing
how this could be made possible. For instance a user would log in to a
web interface and they would set a task that could be an email or text
message that would fire off once or every hour or every day at 1pm,
etc.  Kind of like cron or even something like google calendar
(sending event notifictions).  I was telling them that erlang could
probably handle something like this.  I was thinking about the timer
module.  The timer module would work for this wouldn't it?  I'm not
sure how it would scale though.  Each user could manage their own
timers, it would seem. Anyone have thoughts on this?

thx,

-wes

________________________________________________________________
erlang-questions (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED



More information about the erlang-questions mailing list