I have a web site using apache httpd as the server and mysql as the backend. It publishes a "thought for the day" that has gotten so popular that the server is crashing due to the number of requests. Since the same page is been requested (the thought only changes once a day), is it possible to put a caching server in front of my main server, so that when the same request is made by different clients, the caching server returns the page without having to go to the database?
For slow changing pages, a cache will definitely reduce CPU usage; but in your extreme case, where the page changes once a day, and it's perfectly predictable, it would be far easier to use a simple and fast static file server (lighthttp, nginx, etc) and a cron job to change your "thought of the day" every night.
In fact, a lot of non-interactive web pages can be done this way: periodically rebuild html files from database or any other source, and use simple, fast static web servers.
Absolutely. There are many products that will work well for this. Apache itself can be configured to function this way although, if you are on Linux or UNIX, Squid is the better option as it is specifically designed to do this very job.
On Windows, MS has always offered cache/proxy products that will do this function. Currently this is ISA Server 2006. Although this is dramatically overkill for this type of application.
Squid is my recommendation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With