Cached Results to Reduce Server Load--Is it Acceptable?
"majortommib" <[email protected]> Sun, 27 Sep 2009 03:50:57 -0000
| Newsgroups | gmane.network.gnutella.devel |
|---|---|
| Message-ID | <[email protected]> |
I'm receiving a million+ requests/day while testing the Beacon php GWC code. To reduce the load on the server I've created two static result pages updated every minute resulting in a significant reduction in cpu usage.
Two questions, first given the concept behind the GWC, are results as old as one minute acceptable and second are the changes I made working properly.
The top two requests were ?get=1... and ...hostfile=1, so using .htaccess I used rewrite to serve two different static files. A cron job runs every minute to update the result files:
.htaccess file:
AddType x-mapp-php5 .php
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} gwc.php
RewriteCond %{QUERY_STRING} ^get=1
RewriteRule ^ /get.txt
RewriteCond %{REQUEST_FILENAME} gwc.php
RewriteCond %{QUERY_STRING} hostfile=1$
RewriteRule ^ /hostfile.txt
cron entries (edited):
* * * * * curl -o hostfile.txt "http://beacon.technutopia.net/gwc.php?client=TEST1.0&hostfile=1"
* * * * * curl -o get.txt "http://beacon.technutopia.net/gwc.php?client=TEST1.0&get=1"
The two servers I'd like verified as are
http://beacon.technutopia.net/gwc.php
http://s298220357.onlinehome.us/gwc.php
Thanks in advance for reviewing and/or testing these servers.