Quote:
Originally Posted by rowan
I can't help you with varnish specifics but perhaps you could try a reversed set of rules... rather than a bunch of exceptions for objects that shouldn't be cached, passthrough everything EXCEPT for *.jpg, *.flv etc.
|
Indeed caching can get pretty complex and problems often are not obvious, so if it's not quite working right for you better to only cache things that you're sure are safe to cache.
Having said that, if the caching server is on the same machine as the web server, caching static files can easily hurt performance. The real benefit is in (carefully) caching the output of scripts. If it's on the same machine, reading an extra "cached" copy of the file is no faster than reading the main copy. The only difference is what happens when a file is requested that's NOT in the cache, a cache miss. There's a bunch of extra overhead there, with these cache misses taking as much as for times as long to serve up than they would coming straight from Apache. So you'd be significantly better off just using Apache alone in those cases.
So in caching only static files hurts performance and a small error caching dynamic content causes complex problems. Therefore the cache will only cause you problems if you can't be confident that your dynamic scripts are consistently cached (or not) correctly.
Aside from having the caching work correctly, so as to avoid breaking things in some situations (like when the user has an iphone), if the cache isn't tuned correctly it can slow things down. Did you know that a very large cache is slower than no cache at all? So to is a very small cache, due to excessive misses. The cache has to be the right size in prefer to do you any good at all. What does all this mean? It means that if you have to come to GFY for help setting up your caching proxy, you're probably better off without a caching proxy.