Using a reverse proxy to speed up your local webserver
by Alain Fontaine on Jan.13, 2009, under Technology
Since a couple of weeks I own a Synology Diskstation DS108j with a 500GB disk that I use as a small fileserver and photoserver at home. The device has many more features, like music streaming and blogging, and can even operate as a fully-fledged LAMP server using the latest versions of PHP and MySQL if you want. I personally use it for backups of my PC and MacBook, and mainly to store the photos I shoot with my Sony Alpha 350 DSLR camera.
As I want to share these photos with family and friends, but only have 512 Kbit/s upstream bandwidth with my ADSL line, browsing the photos remotely was sluggish, until I found a nice solution: install a reverse caching proxy using Squid.
First of all, I ordered a small private virtual server at OVH, a french hosting company that offers very big bang for the buck. As this is a personal project, I didn’ consider the fact that their support wouldn’t probably be suited for mission-critical applications. The small root server offers unmetered, 100Mbit traffic, and enough disk space for my needs, for less than 10 euros a month.
Once it was readily setup with a fresh Debian Etch distro, I installed Squid and configured it to act as a reverse proxy to my Synology at home, which in turn is configured to listen to external requests on a particular port.
How does it work out? People connect to the URL of the photo gallery software, which results in a connection to the squid proxy running off the 100Mbit link. the squid then checks whether it has the requested files (photos) in its memory or disk cache, and if found, serves the content immediately. If the requested content is not (yet) in the squid’s cache, it connects to the local Diskstation over the slow DSL link, fetches the files, stores them into its cache, and then serves them to the visitor. This means that the following visitor requesting this photo will get it much quicker, as it will be served out of the cache.
I just asked a friend and work colleague in Australia to test it from down under, and he said that the download speed was very good indeed – done!
Now, you might ask yourself, why didn’t I simply use an online gallery tool to share my photos? Well, I like the fact to be able to simply copy the photos from my DSLR to a shared folder on my Synology drive. That’s all it takes to publish them! The integrated PhotoStation of the Synology device puts them in a gallery automatically, and as soon as someone accesses the photos, they get uploaded and cached on the squid proxy.
No related posts.
Related posts brought to you by Yet Another Related Posts Plugin.
-
http://www.alainfontaine.lu/blog/2009/01/stellar-wordpress-performance/ Stellar Wordpress performance – Alain Fontaine’s Jabberbox
-
http://db.tt/IF9CL2 chris