The CGI plugin was initially blocking, because that was the easiest way to write it. This week I’ve so far worked on moving it to the event-based model.
Initial results were terrible, while I could get it stable, its performance was only 50-60% of that of the blocking model, latency was doubled, and it came with 250 more lines of code.
Today, investigating showed that epoll was firing some 2k pointless write events when we had nothing to write. The couple additional syscalls to remove the wait for write events when we know we don’t need them were quite a win.
The latest CGI plugin is event-based, stable, and better than the blocking one, not counting lines of code though (they increased to 300 ;)).
Performance increased 18% for shell scripts, 88% for the C app, and 26% for PHP. Latency is less than half of the blocking model’s one, it’s sub-10ms now (vs 15-20ms).
For comparison, static pages get 29k on the same setup.