Via Simon Willison, cgi-buffer takes care of the little things that can make your CGI programs go faster. We’re talking things like gzip, ETags, and persistent connections. Libraries for Perl, PHP, and Python are available. At least in python, using it is as simple as import cgi_buffer.
The Ivy software bus also looks interesting:
Ivy is a simple protocol and a set of open-source (LGPL) libraries and programs that allows applications to broadcast information through text messages, with a subscription mechanism based on regular expressions. Ivy libraries are available in C, C++, Java and Perl, on Windows and Unix boxes and on Macs. Several Ivy utilities and hardware drivers are available too.