KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: What is the "Cache Hit Ratio"?
PRODUCT: 4D Server | VERSION: 6.5 | PLATFORM: Mac & Win
Published On: April 28, 2000
Your current browser may not allow you to download the asset. We recommend Mozilla Firefox or Google Chrome.
Log In

The upper portion of the 4D Server 6.5 window displays several useful statistics about 4D Server's memory usage. One of these is a thermometer displaying the "Cache Hit Ratio."

The Cache Hit Ratio is the ratio between the number of times 4D actually finds objects in the data cache, compared to the total number of times it tries to access objects in the data cache. (This also appears as "Global Hit" in the "Cache Statistics" section of the Runtime Explorer's Watch tab and the Debugger's Watch pane.) For example, after you open a database in the Custom Menus environment, the cache hit ratio is zero. The first time you load a record, the cache hit ratio becomes 25%. This means that one out of four attempts to find an object in the cache was successful. Why are there four attempts the first time you load a record, instead of just one? Because to get your record into the cache after the database has been freshly opened, other things need to be loaded into the cache as well, for example, record address pages. If you then try to load the same record again, the cache hit ratio increases to 40%, which means that since the database has been opened, five tries have been made to find an object in the cache, of which two were successful. This time, it only took one try to find the record in the cache, because the record was already there from when we'd loaded it before. The next attempt to load the same record sends the cache hit ratio to 50% -- three out of six tries. Next it will go to 57% -- four out of seven tries. In this manner, the ratio could steadily increase to nearly 100%.

If you click the "Cache Hit Ratio" thermometer, a window displays five thermometers showing how the data cache is being used. For each type of data that can be kept in the cache, a thermometer indicates how much of the data is present in the cache. Higher readings are better, because accessing that type of data will then be less likely to require accessing the disk.