| Right, there is indeed a mode switch to read/write from/to the tcp buffer or accept a connection. Luckily mode switches are not context switches - which are typically massively more expensive - as only one thread is ever involved. Hellepoll uses 'epoll' which is the Linux equivalent of kqueue. Kqueue is said to be marginally faster still, and I look forward to Hellepoll using kqueue when running on FreeBSD. Epoll/kqueue absolutely affect accept rate incidentally, so its an exercise to the reader to work out why ;) Hellepoll does use the fanciest features of epoll like 'edge triggering' which is perhaps one of the things making it nudge ahead of Java's NIO-based webservers (as NIO is lowest-common-denominator and lacks ET). Finally, Hellepoll is really writing meaningful bytes, and it even flushes them in keep-alive connections (obviously; think how it would ever work otherwise?). So I think, on balance, Hellepoll is the real thing and not just measuring how quickly a big backlog on a listening socket can fill up ;) On Linux, I've found the new 'perf timechart' a lot of fun. |
When I said epoll/kqueue doesn't affect the accept rate, I was replying back to a specific request of writing a program to just accept/reply/shutdown. In this case you are passing one fd to the poller which won't matter much what poller you are using.
My original comment is that you are measuring the wrong thing and it's not against hellepoll. requests / sec can be much higher than reply / sec because they get buffered waiting for you to accept them. Once accepted, then a request is counted. What matters though, especially to the http client is how long it takes to serve the connection from start to finish, hence reply rate.
fyi, you can use libev for poller portability.
You can experiment with this command and look at the reply rate.
httperf --num-conns=10000000 -vv --num-calls=1 --port=<your_port>