basav
basav

Reputation: 1453

Capacity planning of the Cache size

How to do the capacity planning of the cache - for e.g. how much RAM to allocate for ehCache, memcache or dynacache? Is there any industry standard formula?

For e.g. I have about 60,000 Records in the database. This is the company data - which contains company name, description and company code. I want to implement a typeahed feature using jQuery and want to store this company name details in the cache.

What would be ideal cache size? I know that cache size is limited to the amount of free memory available but interested to know a specific way? or is t a trial and error where you start with some size and test, plot a graph and keep adjusting the cache size.

Update

Company Id - CHAR(9)

Company Name - VARCHAR2 (250 CHAR)

Company Desc - NVARCHAR2(1000 CHAR)

Upvotes: 17

Views: 1681

Answers (1)

Book Of Zeus
Book Of Zeus

Reputation: 49877

1) If you have a dedicated cache server then you don't have to worry about how much memory space you have to use. You use can use the maximum amount of free memory available (or close to) and let it do its magic.

2) If the caching server is the same as your web server then you will have to specify how much you allow memcached (dynacache or other) to use. For my point of view, there is not really an ideal cache size. It all depends on how much memory your server have, how much data you have to put in cache etc. As long your memory is properly balances between caching and web server you are good.

In this case, you have a little less than 100 MB of data you need to store in cache. Depending how much your server has, it's very small but you will always have to think how much there data grows and also, do you need to add additional data (like clients, products etc...). So if you put less than you need, you will have to stop the service, increase the value of memory allowed, start the service.

If your server process a lot of information that requires lots of memory, then you will have to calculate how much memory and resources these processes takes.

Quick example:

  • 1 Server (cache and web server) with 4G of total memory.
  • System and processes resources including cronjob, database etc.: 3G
  • 60,000 clients with a total of 100Mb (always use more than the actual size just in case)

In this example, 1G of memory left (approximately). It is not recommend to total amount left since you will have enough for your system. I would say using 384Mb or less for your cache will be a good start. You allow your cache to grow and you don't affect your system memory.

I would recommend to monitor your server to make sure the memory allocation for your system and your cache balance perfectly.

Here's a good article about it: http://techgurulive.com/2009/07/22/how-to-allocate-memory-within-memcached/

Upvotes: 39

Related Questions