canonical libwebsockets.org websocket library
Find a file
Andy Green 65b0e91061 listen socket more frequent service
From an idea by Edwin van den Oetelaar <oetelaar.automatisering@gmail.com>

When testing libwebsockets with ab, Edwin found an unexpected bump in
the distribution of latencies, some connections were held back almost
the whole test duration.

http://ml.libwebsockets.org/pipermail/libwebsockets/2013-January/000006.html

Studying the problem revealed that when there are mass pending connections
amongst many active connections, we do not service the listen socket often
enough to clear the backlog, some seem to get stale violating FIFO ordering.

This patch introduces listen socket service "piggybacking", where every n
normal socket service actions we also check the listen socket and deal with
pending connections there.

Normally, it checks the listen socket gratuitously every 10 normal socket
services.  However, if it finds something waiting, it forces a check on the
next normal socket service too by keeping stats on how often something was
waiting.  If the probability of something waiting each time becomes high,
it will allow up to two waiting connections to be serviced for each normal
socket service.

In that way it has low burden in the normal case, but rapidly adapts by
detecting mass connection loads as found in ab.

Signed-off-by: Andy Green <andy.green@linaro.org>
2013-01-16 07:59:47 +08:00
lib listen socket more frequent service 2013-01-16 07:59:47 +08:00
m4 add empty m4 dir as workaround for autoreconf issue 2013-01-15 21:56:12 +08:00
scripts refactor-into-dirs.patch 2010-11-01 09:12:17 +00:00
test-server extpoll use hashtable for fd tracking 2013-01-15 20:44:46 +08:00
win32port zlib update 1.2.7 2013-01-10 10:03:42 +08:00
.gitignore Ignoring linux build files 2013-01-09 15:46:11 +08:00
autogen.sh use autogen.sh 2012-10-06 15:17:01 +08:00
configure.ac allow building just the library not the testapps 2013-01-15 19:57:06 +08:00
COPYING add-COPYING-lgpl-2.1.patch 2010-11-08 17:12:19 +00:00
INSTALL add-INSTALL.patch 2010-11-12 13:11:50 +00:00
libwebsockets-api-doc.html http service break into outer loop states 2013-01-15 16:00:36 +08:00
libwebsockets.pc.in add pkg-config file libwebsockets.pc 2012-10-19 18:26:22 +08:00
libwebsockets.spec uplevel-rpm-spec-to-include-new-extpoll-sample.patch 2011-02-13 09:08:11 +00:00
Makefile.am allow building just the library not the testapps 2013-01-15 19:57:06 +08:00
README-test-server allow LWS_SOMAXCONN to be defined at configuretime 2013-01-15 20:52:29 +08:00