Subject: Re: [RFC] gitweb wishlist and TODO list (part 1)

From: Robert Fitzsimons <[email-masked]>
Date: Thu, 21 Dec 2006 03:22:16 +0000

> * Cache validation and infinite cache for unchanging pages
> 
>   By itself cache validation would not bring much performance boost (for
>   gitweb installations with large traffic), but with the reverse proxy,
>   aka. caching engine, aka. HTTP accelerator in front of server this could
>   help a lot.

There is no need for extra servers to provide server side caching.
Apache2 includes suitable modules (mod_cache) which can be configured to
cache in memory or disk the pages generated by gitweb.

For example the following apache2.conf entry will setup a 8MB mem cache
which will return cached pages even if the user tries to force a refresh
in their browser.  The details are covered in the apache documentation
http://httpd.apache.org/docs/2.2/caching.html .

<IfModule mod_cache.c>
	CacheDefaultExpire 60
	CacheIgnoreCacheControl On
	CacheIgnoreNoLastMod On

	<IfModule mod_mem_cache.c>
		CacheEnable mem /git/
		MCacheSize 8192
		MCacheMinObjectSize 512
		MCacheMaxObjectSize 128000
		MCacheRemovalAlgorithm LRU
	</IfModule>
</IfModule>

mod_cache will only cache pages with a query string in the url if they
have an expires header.  So we can put a temporary hack in using
mod_expires until gitweb sets an appropriate value.

<Location /git/>
	ExpiresActive On
	ExpiresDefault "access plus 1 minutes"
	...
</Location>

Also the content type would need to be change to just return text/html
or MSIE will do the wrong think if it's given a application/xhtml+xml
page.

Robert