Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Varnish vs memcache/d for Apache

I have a HTML website running off Apache and using a MySQL database. I want to speed up my Apache server's response time. I want to get advice on which way I should go? I read on Google that Varnish is used with Apache. So I have two questions:

  1. Can I use Memcache with Apache or not?
  2. If Yes then which one is better, Memcache or Varnish?
like image 579
user115079 Avatar asked Dec 09 '22 00:12

user115079


1 Answers

Comparing Varnish and Memcached is like comparing apples and oranges. Varnish is a caching reverse HTTP proxy, and it sits in front of your Apache web server. Memcached on the other hand is a distributed object caching system. It can be used, for instance, to cache content retrieved from the MySQL server.

Not knowing anything about the specifics of your website, I would say Varnish is the simplest way to go. You could, in theory, just throw it in front of your Apache and have your pages fly. Of course this is not the case in real life. You need to tune Varnish to your specific needs to handle cookies, cache banning etc. efficiently.

Memcached requires changes to your code. You need to go through your code, investigate where you could gain leverage from caching and implement changes as required.

Neither Varnish nor Memcached provides a plug-in solution to speed up your site, but both are excellent tools to help you reach that goal.

like image 85
Ketola Avatar answered Jan 25 '23 20:01

Ketola