diff options
author | Eric Wong <normalperson@yhbt.net> | 2013-06-21 03:34:10 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2013-06-25 21:22:50 +0000 |
commit | 10a38ab650e3e25e37dd70b310631760d0b2000f (patch) | |
tree | cdd8071d89915dcbb7d309676d43e2326d942f2a | |
parent | 4d112de546a28b99d52435d4fed075f148455826 (diff) | |
download | cmogstored-10a38ab650e3e25e37dd70b310631760d0b2000f.tar.gz |
Having too many acceptor threads does not help, as it leads to lock contention in the accept syscalls and the EPOLL_CTL_ADD paths. The fair FIFO ordering of _blocking_ accept/accept4 syscalls also means we trigger unnecessary task switching and incur cache misses under high load. Since it is almost impossible for the acceptor threads to be stuck on disk I/O since commit 832316624f7a8f44b3e1d78a8a7a62a399241840 ("acceptor threads push directly into event queue")
-rw-r--r-- | cmogstored.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/cmogstored.c b/cmogstored.c index 3c3f87c..f87cc67 100644 --- a/cmogstored.c +++ b/cmogstored.c @@ -277,12 +277,12 @@ static bool svc_start_each(void *svcptr, void *qptr) /* * try to distribute accept() callers between workers more evenly * with wake-one accept() behavior by trimming down on acceptors + * having too many acceptor threads does not make sense, these + * threads are only bounded by lock contention and local bus speeds. + * Increasing threads here just leads to lock contention inside the + * kernel (accept/accept4/EPOLL_CTL_ADD) */ - if (worker_processes) { - athr /= worker_processes; - if (athr == 0) - athr = 1; - } + athr = worker_processes > 1 ? 1 : MIN(2, athr); svc->queue = q; |