Do we need to deploy varnish if our Web application is using memcached or do we need memcached if we are using varnish to cache web contents. Can someone recommend some scenarios where should we use one or the other or may be both.
What is the difference between using varnish and caching content in memcached?
varnish;memcached
An HTTP proxy server and memcached are different technologies that solve different problems and apply at different layers of your software stack. Both can be useful.An HTTP proxy server sitting in front of your application can respond to requests from its cache, saving your application from having to handle some of the request load. This only works if your application outputs content that is cacheable and if end users request the content more than once. In order for the content to be cacheable, your application needs to set the appropriate HTTP headers to let proxy servers (and browsers) know what is cacheable and for how long.In the case of requests that make it all the way to your application (they miss the HTTP proxy cache or there is no HTTP proxy), your application has to compute the content it needs to send back. If this computation is expensive but parts of the data can be cached from previous requests, memcached is a good way for your application to stash away the results of [parts of] those computations so they can be reused later. Your application needs to be written specifically to do this, and to connect to memcached instances to get and set this data.