Time To Pull The Plug

This is a subtitle. There are many like it, but this one is here.

Mod_mcpage for Lighttpd 1.5 Svn Patch 0.96.1 (Working)

This new version of the mod_mcpage only adds one new feature (an option, mcpage.announce, to enable or disable the ‘X-served-by-memcached’ response header), but features a number of behind the scenes improvements.

Internally, the request handling was cleaned up and taking content from the chunkqueue was streamlined. The module will also store pages that were compressed by the backend. If the client sends the appropriate headers, it will receive the pre-compressed page, but if it does not the module will decompress it before sending it to the client. There is also code in place to catch some extremely unusual circumstances that can come up with certain versions of IE and deflate. Caching content from http and FastCGI backends has been tested and found working; CGI and SCGI have not been tested, but I believe they are likely to work. Caching static files from disk is working again as well. More details are in the README.

Performance-wise, this version improves on past versions considerably. More stringent benchmarks are still necessary, but with the tiered caching, some TCP tuning, and caching the compressed page from the backend rather than running mod_deflate every time, I was getting 0.229 ms per request (mean, across all concurrent requests) per ab’s stats. Caveats apply of course (home network, ab having somewhat limited applicability to real world situations), but it was a marked improvement. Further benchmarking in different circumstances is forthcoming.

This is a patch for lighttpd 1.5. There’s a tarball with instructions too. This patch still only applies to lighttpd 1.5; a version for 1.4 is on the to-do list.

This patch has all the features of the last one, plus:

  • Optional X-served-by-memcached header
  • Internal streamlining, simplification. Eliminated some unnecessary steps.
  • Fixed some compiler warnings.
  • Improved pulling content from the chunqueue.
  • Store pages compressed by the backend as compressed pages, uncompressing them if requested by a client that doesn’t handle compressed content.

Todo down the road:

  • Real non-blocking fetching.
  • Store compressed pages for local static files or where the backend didn’t compress them for clients that send Accept-Encoding headers, and uncompress them for clients that don’t send them (like it currently does for backend content that was compressed by the backend).
  • Backport to lighttpd 1.4