0

I have a web server which hosts my PHP web app and my MySQL server. I would like to throw out one more machine there to use it for memcache/memcached. In order to use Memcache, should I have a loadbalancer ? or I just use my apache web server to point to it ? I need someone to shed some light into this question and give me an understanding about what I need to do to use Memcached to improve my web app performance.

Thanks a lot :)

2
  • Can you provide more details on your current setup? Memcache may not be the best (or only) way to improve performance. Questions: -How much traffic is this server handling? -Apache or Nginx? -MySQL - how much RAM, Raid, etc.?
    – gmck
    Nov 16, 2012 at 20:03
  • It's a Xeon Quad Core 3.2 with 16G RAM, One Medium size SSD disk, Apache, MySQL InnoDB, and The Traffic is 5000 users send request to the server in an hour at the same time, so there are high chance of handling a thousands request per sec, The DB is on the same machine, so sometimes the load is too much to do I/O and stuff. I may want to use APC which is an aternative. But basically wanna know about Memcache a bit where what it takes to set one up ? Can I just get one more machine and set up memcache or I need a load balancer too ?
    – Alex
    Nov 19, 2012 at 15:28

2 Answers 2

1

The following is based off opinion, but has shown to work very well for me YMMV:

If you only have one webserver I would stick with APC (can cache data for you as well) the big benefit of having memcache is for a multi server environment to share sessions and cached data (without putting more load on the database).

If you were to setup another machine I would split your database off to another server and behind a firewall or in some way block it from the outside world. Set that machine up to be able to process read writes fast with enough memory for internal db caching.

Only when you move to a multi web head environment would I use memcached and then yes you would probably have a load balancer, although a nginx setup could do that for you so you wouldn't need a hardware load balancer.

Before you do anything I would setup a development environment that matches the production environment as much as possible and then use something like Jmeter to put higher then expected loads on it to verify it would work for you application needs.

HTH

0

Installing memcache is pretty straight forward. There is a good guides to get started at http://docs.webfaction.com/software/memcached.html lullabot.com/articles/installing-memcached-redhat-or-centos addmoremem.blogspot.com/2010/09/running-multiple-instances-of-memcached.html

Your applications need to be memcache aware to use its functionality.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .