Pcache is aimed at servers delivering large files. It collects requests, priodically choose files to be cached, and asynchronously caches them in SSD. It does not cause client's wait for caching files differently from mod_disk_cache.
Pcache consists of a piped logger (pcache.pl) and rewrite rules. pcache.pl is distributed on GitHub. Please read README for the detailed instruction to use it. I will show you an excerpt. The logger is kicked by the following CustomLog directive.
CustomLog "|/somewhere/pcache.pl" "%>s %O %f"After it collects requests for 2 hours, it chooses files to be cached and copy them in SSD. To allow httpd to fetch cached files, you must specify rewrite rules as follows.
RewriteCond /somewhere_on_ssd$1 -f
RewriteRule ^(.*)$ /someware_on_ssd$1
pcache.pl chooses files based on the exponentital moving average of transferred bytes of each file. It calculates the average by adding 2% of transferred bytes for 2 hours to 98% of the previous average. These parameters work fine for our server. The cache of 260GB covers about 70% of the transferred bytes against contents of 20TB.
0 件のコメント:
コメントを投稿