libwebsockets/lib
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
..
.gitignore Ignoring linux build files 2013-01-09 15:46:11 +08:00
base64-decode.c introduce logging api and convert all library output to use it 2013-01-10 22:16:37 +08:00
client-handshake.c deal with SSL_ERROR_WANT_ in client connect action 2013-01-15 15:43:31 +08:00
extension-deflate-frame.c logging ensure everyone has a newline 2013-01-15 15:41:15 +08:00
extension-deflate-frame.h Separate compression levels for server and client, 2013-01-10 12:45:54 +08:00
extension-deflate-stream.c introduce logging api and convert all library output to use it 2013-01-10 22:16:37 +08:00
extension-deflate-stream.h Fixed deflate-stream extension. 2013-01-09 18:17:42 +08:00
extension-x-google-mux.c audit and make all malloc check for OOM 2013-01-12 13:21:08 +08:00
extension-x-google-mux.h Use __inline for Win32 builds. 2013-01-10 10:07:16 +08:00
extension.c Added extension "deflate-frame". 2013-01-09 18:21:33 +08:00
getifaddrs.c introduce getifaddrs for toolchains without it 2013-01-12 20:39:47 +08:00
getifaddrs.h introduce getifaddrs for toolchains without it 2013-01-12 20:39:47 +08:00
handshake.c http service break into outer loop states 2013-01-15 16:00:36 +08:00
libwebsockets.c listen socket more frequent service 2013-01-16 07:59:47 +08:00
libwebsockets.h http service break into outer loop states 2013-01-15 16:00:36 +08:00
Makefile.am introduce getifaddrs for toolchains without it 2013-01-12 20:39:47 +08:00
md5.c introduce-private-md5-sha1.patch 2011-01-23 17:47:08 +00:00
parsers.c http service break into outer loop states 2013-01-15 16:00:36 +08:00
private-libwebsockets.h listen socket more frequent service 2013-01-16 07:59:47 +08:00
sha-1.c Static variable is now const. 2013-01-09 15:14:31 +08:00