Why would I use Squid

PROXYreverse-proxysquid

I have Googled, searched StackOverflow and here. Still I can not fully understand what or why someone would use Squid.

All I can find out so far is that it is some sort of cache that can make it less work that your server (i.e. Apache) has to do. So can someone clarify exactly what Squid does and more importantly, why would I want to use Squid?

I have a large social network site so maybe it would benefit for serving images or something, I am currently running lighttpd seperate from Apache, just for serving images.

Best Answer

Squid is a web cache that caches web content, and returns it quickly on request. Handling a request through squid is frequently faster than a general-purpose webserver even for simple files (e.g. images), but it really comes into its own for caching pages that are dynamically generated, which can be expensive and slow. It thus allows you to build your pages dynamically but lets you serve a static, cached copy quickly to requesters. There's a lot of configuration possible about how long it caches for, which pages it caches, and how to invalidate a cached result.

For instance, Wikipedia uses caches (squid and others) as a content accelerator, so that every hit on a page doesn't make it be regenerated from the database through a lot of PHP. When pages are changed, the cache entry is invalidated.