Date: Sun, 5 Jan 2003 04:12:39 +0100 From: Felix von Leitner To: fnord mailing list Subject: Re: platform specific event notification web server Message-ID: <20030105031239.GA18982@codeblau.de> Mail-Followup-To: fnord mailing list Happy new year, everyone! > http://www.fefe.de/fnord/enot.tar.gz I updated the URL. It is still a quick hack, but now it includes a small web benchmark and appears to actually work most of the time. The web server is called artillery, the benchmark program bench. Run artillery without arguments to choose the best available API, with "p" to stay with poll(2), with "s" to use SIGIO, with "e" to enable epoll. Once I finish my BSD installation, I will try to port it to sigio. So far the results look very good. To quote a friend of mine about typical open source development: "Of course it doesn't work, but look how fast it is!" ;-) My benchmark uses gettimeofday and non-blocking I/O, by the way. If you specify a concurrency, it uses fork() and wait(). It tries to be quite efficient; here is an strace excerpt from a keep-alive benchmark: socket(PF_INET6, SOCK_STREAM, 0) = 3 connect(3, {sa_family=AF_INET6, sin6_port=htons(8000), inet_pton(AF_INET6, "::ffff:127.0.0.1", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, 28) = 0 write(3, "GET /Makefile HTTP/1.1\r\nHost: lo"..., 72) = 72 read(3, "HTTP/1.0 200 OK\r\nConnection: kee"..., 4096) = 454 write(3, "GET /Makefile HTTP/1.1\r\nHost: lo"..., 72) = 72 read(3, "HTTP/1.0 200 OK\r\nConnection: kee"..., 4096) = 454 write(3, "GET /Makefile HTTP/1.1\r\nHost: lo"..., 72) = 72 read(3, "HTTP/1.0 200 OK\r\nConnection: kee"..., 4096) = 454 write(3, "GET /Makefile HTTP/1.1\r\nHost: lo"..., 72) = 72 read(3, "HTTP/1.0 200 OK\r\nConnection: kee"..., 4096) = 454 write(3, "GET /Makefile HTTP/1.1\r\nHost: lo"..., 72) = 72 read(3, "HTTP/1.0 200 OK\r\nConnection: kee"..., 4096) = 454 close(3) = 0 And here are some numbers (from my 2.4.20 kernel patched to include /dev/epoll support), 5000 requests each. c = concurrency, k = keep-alive, times are in seconds. c 1 c 1 k c 10 c 10 k /dev/epoll 0.614 0.165 1.130 0.294 sigio 0.622 0.177 1.171 0.315 poll 0.614 0.199 1.190 0.367 now the same with 500 idle connections: /dev/epoll 0.628 0.210 1.127 0.344 sigio 0.651 0.224 1.178 0.364 poll 3.991 6.253 7.517 6.358 Please note that using poll apparently has a huge variance. Those are single benchmark runs, I also measured 3.318 for the c 10 k case. I don't know the reason for this, but I can reproduce it consistently. BTW: If you understand German, you may be interested in a small presentation I did recently at the 19C3 (www.ccc.de/congress/), the slides are up at http://www.fefe.de/scalable-networking.pdf, however it is still written in German. Felix