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)
The higher the demand from these factors, the larger the cache needs to be to maintain good performance. Disk caches smaller than 10 MB do not generally perform well. Machines serving multiple users usually perform better with a cache of at least 60 to 70 MB.
Storage capacity planning is the practice of assessing current data storage needs and forecasting future storage requirements. The goal is to purchase just enough disk space to meet the needs of users and applications.
The maximum theoretical cache size is 2 GB. The size of cache you can specify is limited by the amount of physical memory and paging space available to the system. The shared class cache consists of memory mapped files that are created on disk and remain when the operating system is restarted.
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:
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/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With