Monday, August 19, 2013

Jetty's Cache Locality Problem

Interesting reading at the Jetty blogs as they experiment with threading models (which is what I am doing at the moment on my little home-mode server project).

This bit in particular caught me eye - the discussion of whether it is best to parse in one thread and then hand over to another:

"Our retrospect-a-scope now tells us that is is a very bad idea to have a different thread do the HTTP parsing and the handling.  The issue is that once one thread had finished parsing a HTTP request, then it’s caches are full of all the information just parsed. The method, URI and request object holding them,  are all going to be in or near to the L1 cache.   Dispatching the handling to another thread just creates the possibility that another core will execute the thread and will need to fill it’s cache from main memory with all the parsed parts of the request."