[erlang-questions] What's the most efficient method to broadcast a message to multiple (100Ks) of processes?
Joel Reymont
joelr1@REDACTED
Thu Oct 7 14:11:54 CEST 2010
http://groups.google.com/group/erlang-programming/browse_thread/thread/1931368998000836/b325e869a3eea26a
Basically, raise priority to high around your sending loop and then get it back to normal right after.
On Oct 7, 2010, at 8:01 PM, Zvi wrote:
> Hi,
>
> what's the most efficient method to broadcast a message to multiple
> (100Ks) of processes?
>
> The most naive way is:
>
> [ Pid ! Msg || Pid<-Pids ].
>
> less naive method:
>
> [ spawn(fun() -> [Pid ! Msg || Pid<-PidsSublist] end) ||
> PidsSublist <- partition(Pids, N) ].
>
> where partition(L,N) splits list L into N sublists.
>
> Any ideas for better method?
---
http://twitter.com/wagerlabs
More information about the erlang-questions
mailing list