How much memory should be allocated to memcache on a small EC2 intance (1.7 GB RAM). The OS is Ubuntu Hardy.


| improve this question | | | | |
  • 1
    There's no way anyone can answer this, you've given us no information about what your server's doing or what you're trying to achieve. – Chopper3 Apr 23 '10 at 21:26
  • @Chopper3 I am new to this so not sure what other information needs to be provided but I will try. Memcache is installed so then it will cached sql queries instead of the app quering the database. Memcache will be used by three applications, our main app, Wordpress and OpenX. We will not be running a seperate memcached server but the apache-app role on EC2 have memcache installed. Please let me know if more information is needed. Thanks. – April Apr 23 '10 at 22:13
  • 1
    Have you first enabled the built-in MySQL query cache? Adding memcached on a single, multi-purpose 1.7GB instance may do more harm than good, if it reduces the RAM for MySQL. – ceejayoz Apr 9 '12 at 19:54

You can approach this in two different ways...

  1. Find out how large each object is that you will be caching and then calculate how many of each object you think you will be caching. From there, do the math and add some headroom (1/3 or 1/2 extra).

  2. (My recommendation in this very simplistic use case) Alternatively, you can just create an instance and monitor the total number of bytes that are in the memcached over time and increase the size as necessary. There are many tools available that will provide memcached statistics do do this.

FYI, pedantic, I know, but the product is "memcached" not "memcache" and you will have better results in your searches if you keep that in mind.

| improve this answer | | | | |

PhpMemcachedAdmin (http://code.google.com/p/phpmemcacheadmin/) is a great tool for monitoring your memcached instances. By watching the evictions rates you should get a feel for whether you are running into problems with the expiration.

| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.