Tokens are very interesting.
A key thing I've learned on my travels is how critical shared state is to performance.
At its crudest, lots of web frameworks read a request, wait to receive it all, dispatch it to a handler, gather all the output from the handler, buffered, and then write it.
This is great from the code organization perspective.
Hellepoll is so very much faster because it streams the requests.
Without a green threading approach, this necessarily makes the code slightly uglier, and much more for the coder to juggle.
Of course there are at least three layers in an event loop framework:
* the programmer making the event loop itself who has to juggle everything;
* the prorgammer making the various protocol handlers who has to understand everything too but fits the framework conventions rather than creates them;
* finally the programmer who is using the framework who gets to use the utility and decoration and wrappings made by the protocol programmer and who hopefully doesn't have to understand in anything but the broadest terms the way the framework ticks.
I'm a big fan of Clojure and STM, but that's correctness over performance. I would hope whoever makes some other platform puts as much effort into hiding and protecting the inner shared state that is so critical to performance.