Okay I lied, eAccelerator gives a pretty darn high ROI, but setting up a proxy cache gives a comparable or higher ROI. I chose to use Varnish as my proxy cache.
Once installed, Varnish will keep a cache of all objects requested by internet users (e.g. post-generated PHP pages, CSS, javascripts, images) with the goal of off-loading some work from your web server (remember: we won’t want big Apache to do the work only if it has to). Also Varnish takes full advantage of the OS’s virtual memory and advanced I/O features on FreeBSD 6.x making it the optimal choice for my setup.
There were many confusing instructions on the web about how to configure Varnish. Here are the steps I took to setting up Varnish for a signal machine running both Varnish and the web server:
1) Port install Varnish.
cd /usr/ports/www/varnish/; make install clean
2) Change Apache’s port to 8080 by modifying this line in /usr/local/etc/apache/httpd.conf
Listen 8080
3) Restart Apache
/usr/local/etc/rc.d/apache22 restart
4) Start the Varnish daemon. Substitute the IP below with your machine’s internal network IP address. If you are hosting at home, it is most likely 192.168.0.* but you can run ifconfig to find out what it is.
varnishd -a <your-machines-internal-ip-address>:80 -b localhost:8080
That’s it! From now, all requests on port 80 should now be routed through the Varnish proxy cache. A proxy cache miss will seemlessly make Apache calls to serve the internet user without the user ever knowing it! A proxy cache hit would not access Apache (and therefore not access MySQL) lessening your machine CPU usage and increasing the speed & efficiency of serving objects to user.
| 2.5 |
Thaya Kareeson 

October 21st, 2007 at 8:14 pm
Do you add
enable_varnish=”yes” to rc.conf too??
or is it varnishd
[Reply]
October 21st, 2007 at 8:15 pm
p.s. you should have another tag that says LAMP
[Reply]
October 21st, 2007 at 8:20 pm
i just saw the css changed in front of my eyes lol
you are working on the first post thing right ??? lol
[Reply]
October 22nd, 2007 at 5:44 pm
and these two magic sentences too
varnishd_enabled=”yes”
varnishd_flags=”-a 192.168.x.x:80 -b localhost:8080″
yaay!!~~
[Reply]
October 22nd, 2007 at 10:17 pm
Thanks Mek from zerverize.com for the rc.conf settings! This was the gap I’ve been trying to fill for ages!
[Reply]
October 23rd, 2007 at 12:09 am
Small correction, varnishd_enabled=”yes” should be varnishd_enable=”yes” (without the ‘d’).
[Reply]
March 14th, 2008 at 3:48 pm
[...] Proxy Caching [...]
April 20th, 2008 at 1:18 pm
[...] time by 25%! But if that’s still not fast enough for you, I will show you how to do Proxy Caching next. ids.push(58); if (!sz_post_config_params){var sz_post_config_params = new Array();} [...]