Dear Cache Guys,
How much memory should I dedicate to a cache? And how do I know what the right size is?
This is a great question. In fact this question has helped several aspiring computer scientists earn PhD’s, yet it is still difficult to answer.
Before getting to the technical heart of this issue, let’s look at an analogy: when a young man purchases a diamond ring for someone he wants to marry. He wants to buy a diamond large enough to impress his betrothed and demonstrate his love and commitment, but not so large as to show he doesn’t understand the value of money. Purchasing a diamond is something someone might do only once (or twice!) and exposes us to a bewildering number of options. The ‘right’ ring is different for every person, depending on values and sense of style.
Similarly, the 'right' cache size is different for every datacenter, depending on applications and I/O access patterns. The purpose of a cache like Infinio's is to provide fast access to I/O and to reduce disk requests, so we want the cache to hold as many disk blocks as will be used by the VMs running on the ESXi server. If the cache is too small then data must be retrieved from a slow disk rather than the fast cache. If the cache is too large then it consumes resources that could be used by VMs running business workloads.
The I/O working set
When sizing a cache, the perfect size is one that will fit the I/O working set running on an ESXi server. The I/O working set is the data that is actually being read and written to disk, not the size of data on the disk. The working set is often hard to determine as it is a combination of the data being accessed by all VM’s running all applications. It is not necessarily related to the size of the virtual disks spread among VMs. Here’s an illustration:
You can see that while the disks may be large, only a small number of blocks are actively being accessed. This illustration shows a small I/O working set in otherwise huge disks, where the working set is easily captured in the cache.
Relatively small I/O working sets are common. For example, during a work day frequent updates to an online ordering system is a common operation, resulting in a small working set: just the blocks corresponding to the records being updated. Batch processing, which has a larger working set, may be reserved for times when less is happening on the servers.
The point is that there is no single answer that applies to every site, and the ‘perfect’ size may change depending upon workloads, and as VMs are created or vMotioned to and from the server.
Methods for sizing cache
Some Infinio customers take their cue in sizing cache from hybrid array vendors; hybrid arrays tend to have a cache tier that is 10% the size of the spinning drives. Other Infinio customers start with the minimum cache size allowed (8GB of RAM) and move up from there. Still others look at what resources are available to dedicate to caching and decide to use all of them. Whatever they choose, it's easy (and requires no downtime) to change the amount of resources dedicated to Infinio for cache.
Our diamond-purchasing young man above may initially be fooled into thinking he will live happily ever after once said diamond is firmly on the finger of his betrothed, but marriage and life are dynamic systems with changing requirements and workloads. Just like your VMware site! You will want to periodically review the workloads on your servers and may find adjustments will benefit the overall operation and deliver faster response times and better user satisfaction.