Interesting. But, is there really a probem to solve here?
Is the point here to free up mod_perl processes faster so that they can
handle other connections? Does that really have anything to do with better
performace in serving up pages?
I don't think you can look at file extensions and determine when to close
the connection. Can you count on how the browser will send requests? For
the bulk of images are often loaded via css. Are you scanning the css,
too? What if you have multiple servers? Connections will be on different
If customizing the keep alive is that critical then I think it's time to
look at other techniques. Use a balancer and let it decided how to manage
the connections (perlbal keeps the connection open forever). Use sprite
sheets to reduce the number of required connections. Use a CDN and cache
static content forever -- and rarely hit your serve. In the end, each "page
view" should only be one request to your mod_perl server anyway.