ev_async watcher's callback is never triggering on ev_async_send()

Marc Lehmann schmorp at schmorp.de
Mon Jul 1 04:52:01 CEST 2013

On Sun, Jun 30, 2013 at 09:30:25AM -0700, trafdev <trafdev at mail.ru> wrote:
> Trying to rewrite code from
> NUM_CORE processes listening and processing incoming requests
> to
> one thread listening\accepting requests, NUM_CORE threads processing
> them.
> Expecting significant performance increase - processes switch must be
> more expensive then
> async watchers\mutexes overheads.

If you run NUM_CORE processes then where would you have process switches?

Keeping the threads in sync and bouncing shared data between caches might,
in fact, cost a lot more than the synchronisation between processes (or a
lot less, if you have a lot of communication going on anyway).

So, best benchmark to make sure that threads are actually faster - if you
already have a solution where you can run processes independently of each
other, threads would only help if you need heavy operations between them,
such as exchanging handles or a lot of data. Without that, threads only
add overhead.

                The choice of a       Deliantra, the free code+content MORPG
      -----==-     _GNU_              http://www.deliantra.net
      ----==-- _       generation
      ---==---(_)__  __ ____  __      Marc Lehmann
      --==---/ / _ \/ // /\ \/ /      schmorp at schmorp.de
      -=====/_/_//_/\_,_/ /_/\_\

More information about the libev mailing list