From 5fae0f0b9afd2396458d3dd9496a90eebd0cc626 Mon Sep 17 00:00:00 2001 From: Jason Edgecombe Date: Sat, 13 Feb 2010 11:31:09 -0500 Subject: [PATCH] Add a section on how to tune the AFS cache using xstat_cm_test The cache tuning section covers how to use xstat_cm_test to measure the cache miss percentage. LICENSE BSD Change-Id: I895dbbecd7e16d44e18fa65e5e1aa1da5c567a06 Reviewed-on: http://gerrit.openafs.org/1308 Tested-by: Jason Edgecombe Reviewed-by: Jeffrey Altman Reviewed-by: Derrick Brashear Reviewed-by: Russ Allbery Tested-by: Russ Allbery --- doc/xml/AdminGuide/auagd015.xml | 125 +++++++++++++++++++++++++++++++- 1 file changed, 124 insertions(+), 1 deletion(-) diff --git a/doc/xml/AdminGuide/auagd015.xml b/doc/xml/AdminGuide/auagd015.xml index 456e22aac..885bd531d 100644 --- a/doc/xml/AdminGuide/auagd015.xml +++ b/doc/xml/AdminGuide/auagd015.xml @@ -1511,8 +1511,130 @@ + + + + Tuning Cache Configuration + + + cache + tuning + + + + performance + cache + + + + Tuning the parameters of the OpenAFS cache for optimal performance + is highly dependent on the behavior of applications and users on a + client machine. The default options may perform poorly under + certain conditions. + + + + The xstat_cm_test command is + useful for measuring how effectively the cache is operating. The + following procedure may be used to aide in tuning the parameters + for the data cache (dcache) and the stats cache (vcache): + + + + Run the following command and replace "hostname" with the hostname of the machine to be measured: + + xstat_cm_test hostname 2 -onceonly + + + + Take note of the following fields: dcacheHits, dcacheMisses, + vcacheHits, and vcacheMisses. Saving the above command + output to a file or filtering it using grep is advised. + + + + + Using the noted fields, compute the miss ratios for the + dcache and vcache using the following formulas: + + + dcache miss ratio = dcacheMisses / ( dcacheMisses + dcacheHits ) + + + + + vcache miss ratio = vcacheMisses / ( vcacheMisses + vcacheHits ) + + + As a guideline, a miss ratio of 0.05 (5 percent) or less is + acceptable and a miss ratio of 0.01 (1 percent) or less is + recommended. + + + + + If your dcache miss ratio is too large, then cache + performance is likely to improve if the data cache is made + larger. If the vcache miss ratio is too large, then increase + the size of the stat cache using + the -stat parameter + to afsd for a Unix-based + client or using the Control Panel or registry interfaces on + Microsoft Windows-based clients. The default size of the + stat cache is 10,000 entries on windows platforms and 300 + entries on Unix platforms. There may be a significant + performance penalty when the vcache size is much smaller + than the working set of commonly accessed files. On the + fileserver, the number of callbacks should be more than the + size of the vcache of any client that connects to the + server. If the cache is too small or there aren't enough + callbacks (-cb) on the + fileserver, then the cached entries will be discarded + prematurely, causing thrashing. + + + As an example of how the wrong vcache size can degrade + performance, one OpenAFS site had performance issues + with the Apache and mod_php software on a Unix web + server serving web pages directly out of AFS. During + peak times, the load on the server would spike with an + excess of Apache processes. After profiling, it was + found that Apache and PHP made lots + of stat() library calls + and that the default vcache size of 300 was too + small. After some experimentation, a vcache size of + 50,000 was found to improve performance. This size makes + sense in light of that fact that the total number of + files in the website exceeded 350,000, including 50,000 + PHP files. The number of callbacks configured on the + fileserver was 1,500,000, so the vcache size was not too + large. + + + + + + + After changing your configuration appropriately and + restarting the AFS client service, wait until enough data + has been collected before changing the configuration + further. The sum of the hits and misses should be at least + five times the value of the configured parameter before + making further adjustments. Repeat this process until the + desired miss ratio is achieved. Take note that the numbers + from the xstat_cm_test + command only reset when the client is restarted. If multiple + samples are taken, then subtract the previous measurement + from the current measurement to accurately measure the + activity that happened between the samples. + + + + + + Maintaining Knowledge of Database Server Machines @@ -3909,4 +4031,5 @@ - \ No newline at end of file + + -- 2.39.5