Search code examples
memcachedlampapcvarnish

Is it good to have Memcache, APC and Varnish on LAMP servers


I have 3 web servers I need to optimize. I currently have just a little over 2000 unique visitors a day and I want to improve performances on my servers to make sure when I will get more traffic everything will run smooth.

I read (on some blogs) APC, memcache and Varnish was the best tools to optimize web sites performances.

Is it good to use ALL three at the same time if I have static (for example terms and conditions page) and dynamic contents (user settings page)?

Thank you very much, J.


Solution

  • The number of visitors per day doesn't really mean anything, it is the peaks that kill you. If all 2000 hits per day come within a one minute peroid, then you might have problems, but if they are evenly spread out throughout the day even on a highly computational webapp you shouldn't have much issues.

    Regardless, if you wish to scale, Varnish will probably help you the most as it allows you to set up client side caching which is as efficient as you can get as it limits the amount of interaction with your server.

    APC and memcache are a fallback for when Varnish isn't able to serve a result. APC will speed up your PHP. memcache allows you to do things like grabbing some complex data from you database for a user and then serving up a cached version of that data for users for the next x minutes/days/weeks. This can make a huge difference if you have any time consuming queries.

    Edit: I've been meaning to try out Cloudflare CDN for a while now and after doing so I had to come back and recommend it. They have a free account (which I'm using) and setting it up is pretty easy as long as you know how to change DNS records. Out of all the technologies mentioned, this will probably be the best first step you can take to speed up your site. Just so you know I don't have shares in Cloudflare or anything like that, but I'm seriously considering it. :)