Created
September 15, 2012 13:00
-
-
Save frimik/3727695 to your computer and use it in GitHub Desktop.
Apache mod_disk_cache + mod_expires for 30x to 400x faster puppet file_metadata* requests.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Several other articles written about similar setups but | |
# this seems like the most simple one if you're already using | |
# Passenger under Apache | |
# | |
# http://paperairoplane.net/?p=380 | |
# http://www.masterzen.fr/2010/03/21/more-puppet-offloading/ | |
# | |
# Add %D for "The time taken to serve the request, in microseconds." | |
LogFormat "%h %l %u %t \"%r\" %>s %b %D \"%{Referer}i\" \"%{User-Agent}i\"" puppet | |
<VirtualHost *:8140> | |
CustomLog /var/log/httpd/puppet.log puppet | |
<IfModule mod_expires.c> | |
<Location /production/file_metadatas/> | |
ExpiresActive On | |
ExpiresDefault "access plus 30 minutes" | |
</Location> | |
</IfModule> | |
<IfModule mod_disk_cache.c> | |
CacheEnable disk /production/file_metadata/ | |
CacheEnable disk /production/file_metadatas/ | |
CacheRoot "/var/cache/mod_cache" | |
CacheDefaultExpire 1800 | |
CacheIgnoreNoLastMod On # needed because puppet master doesn't add Last-Modifiedu | |
</IfModule> | |
</VirtualHost> | |
# explanations | |
# | |
# Why mod_expire on file_metadatas/? | |
# file_metadatas/ requests carry query?parameter strings and documents without Expires headers will NOT be cached: | |
# http://httpd.apache.org/docs/2.2/mod/mod_cache.html#cacheignorequerystring | |
# "requests with query string parameters are cached separately for each unique query string. | |
# This is according to RFC 2616/13.9 done only if an expiration time is specified." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment