[erlang-questions] Re: Unicast 20k messages, $500-$1000 bounty
Paulo Sérgio Almeida
Thu Jul 16 22:47:09 CEST 2009
Joel Reymont wrote:
> On Jul 16, 2009, at 6:18 PM, Cliff Moon wrote:
>> The problem you're seeing there is process scheduling overhead. In
>> the fun it sends a message and it's doing an ungodly amount of context
>> switching. The way to get around this is to bump the process priority
>> level of the process which iterates the ets table.
I don't think the pubsub causes a huge amount of context switching.
Sending a message in itself should not cause context switching. But
there is in fact a huge amount of context switching due to the 2 * 20k
This means that even if the pubsub is preempted a single time, it will
have to wait for a lot of switching before resuming the sending. Making
the pubsub priority high makes it complete the sending to everyone
before being preempted.
However, I still think that performance should improve noticeably if
there is one less hop of middlemen: it will be at least 20k less context
switches and 20k less messages.
More information about the erlang-questions