From ac5f0ef7cf501693a9db2fcbd95b7cde419cbb2a Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Thu, 10 Aug 2017 00:10:50 -0700 Subject: Thundering herd kills performance. A little benchmarking showed that we were encountering far too many wakeups, leading to severe performance degradation; we had a bunch of threads all sleeping on the same condition variable (taskqs) and this woke them all up, resulting in heavy mutex contention. Since we only need one of the threads to wake, and we don't care which one, let's just wake only one. This reduced RTT latency from about 240 us down to about 30 s. (1/8 of the former cost.) There's still a bunch of tuning to do; performance remains worse than we would like. --- src/core/aio.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/core/aio.h') diff --git a/src/core/aio.h b/src/core/aio.h index 0f41c01f..d48442eb 100644 --- a/src/core/aio.h +++ b/src/core/aio.h @@ -34,7 +34,8 @@ struct nni_aio { unsigned a_pend : 1; // completion routine pending unsigned a_active : 1; // aio was started unsigned a_expiring : 1; // expiration callback in progress - unsigned a_pad : 27; // ensure 32-bit alignment + unsigned a_waiting : 1; // a thread is waiting for this to finish + unsigned a_pad : 26; // ensure 32-bit alignment nni_task a_task; // Read/write operations. -- cgit v1.2.3-70-g09d2