> On Apr 16, 2018, at 5:19 AM, Kostas Liakakis <kos...@physics.auth.gr> wrote:
> 
> I am running an OpenAFS 1.6.11 client against a set of 1.6.20 servers. I am 
> trying to find out if my client's cache is underutilized or thrashing because 
> if it running out of entries. I've read the documentation here ( 
> http://docs.openafs.org/Reference/5/afs_cache.html ) and the afsd page here ( 
> http://docs.openafs.org/Reference/8/afsd.html ) but I think I still don't 
> have the whole picture. So I'd like some help understanding the disk based 
> cache configuration.
> 
> My cache is configured via /etc/openafs/cacheinfo with 1000000 blocks (1GB) 
> of maximum space. afsd is started with -dynroot -fakestat -afsdb flags.
> 
> Now, what I read from the afsdb manual my chunksize by default should be 
> between, 256KB and 1MB. I can tell by looking at the Vn files in the cache 
> directory that chunksize is 1M, since there is no file greater than this size 
> while a few are more than 1023KB.
Yes, this is the correct default chunksize for a cache with 1000000 blocks - so 
far, so good.

> I also read that my Vn files number should by default be chosen as the 
> greater of (100, 1000000/10240, or 1.5*1000000/1024). The latter being the 
> greater I'd expect to find no more than 1464 Vn files in my cache directory. 
> Contrary to this, du --inodes says there are 31270 files in my cache 
> directory. Indeed, the highest numbered Vn file is V31249 and the rest of 
> used inodes can be attributed to parent directory entries.
This documentation is unfortunately outdated.   The number of files you ended 
up with is consistent with the number of blocks and chunksize (see source code 
in src/afs/afsd.c).

> So what am I missing here? How does the cache manager calculate the limit to 
> Vn files?
The algorithm in the 1.6.11 Unix cache manager (afsd) is (from afsd_run()):
...
2033             cacheFiles = cacheBlocks / 32;      /* Assume 32k avg filesize 
*/
You specified cacheBlocks 1000000, so this gives cacheFiles = 31250, the number 
you reported.
2034 
2035             cacheFiles = max(cacheFiles, 1000);
cacheFiles remains 31250
2036 
2037             /* Always allow more files than chunks.  Presume average V-file
2038              * is ~67% of a chunk...  (another guess, perhaps Honeyman will
2039              * have a grad student write a paper).  i is KILOBYTES.
2040              */
2041             i = 1 << (chunkSize < 10 ? 0 : chunkSize - 10);
Your chunksize was 20, so i=1<<(20-10)=1024
2042             cacheFiles = max(cacheFiles, 1.5 * (cacheBlocks / i));
1.5*(cacheBlocks 1000000/ i 1024) = 1464
so cacheFiles remains 31250.


You may find the following commands useful when tuning the cache:

cmdebug <client> -cache         # gives the current cache configuration

xstat_cm_test <client> 2 -onceonly | head -n 35         # gives live cache 
statistics

Regards,
--
Mark Vitale
mvit...@sinenomine.net



_______________________________________________
OpenAFS-info mailing list
OpenAFS-info@openafs.org
https://lists.openafs.org/mailman/listinfo/openafs-info

Reply via email to