]] Lennart Poettering > On Thu, 10.10.13 13:12, David Strauss (da...@davidstrauss.net) wrote: > > > I was actually planning to rewrite on top of libuv today, but I'm > > happy to port to the new, native event library. > > > > Is there any best-practice for using it with multiple threads? > > We are pretty conservative on threads so far, but I guess in this case > it makes some sense to distribute work on CPUs. Here's how I would do it:
[snip long description] fwiw, if you want really high performance, this is not at all how I'd do it. Spawning threads while under load is a recipe for disaster, for a start. I'd go with something how it's done in Varnish: Have an (or n) acceptor threads that schedule work to a pool of worker threads. That scheduler should be careful about such things as treating the worker threads as LIFO (to preserve CPU cache). The advice about only 2-3 threads per CPU core looks excessively conservative. We're usually, and quite happily running with a few thousand threads, no matter the number of cores. Using REUSEPORT might make sense in cases where you're happy to throw away performance for simplicty. That's a completely valid tradeoff. -- Tollef Fog Heen UNIX is user friendly, it's just picky about who its friends are _______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel