When the evaluator sends a value to the Vesta cache to be stored, the cache daemon treats it as an opaque block of bytes. It simply stores it and retrieves it when it's needed. When the cache stores an entry it includes both this opaque byte sequence as well as the dependency information needed to facilitate matching on future lookups as well as some other information needed to facilitate weeding.

Two of the statistics reported by VCacheStats are the size of PKFiles and the size of the cached values bytes. Each PKFile includes both one or more cached values and the extra dependency/weeding book-keeping information. How much of the space in a PKFile is taken up by the cache values, and how much is the other information?

We're going to cheat here and just answer the question for a MultiPKFile as that's easier. (Most MiltuPKFiles contain a single PKFile. We could do it for a single PKFile if we wanted to do a little more work.)

First let's find our MultiPKFile. The Primary key we're interested in (provided by VCacheStats) is:

81092c90e53efa49 d00066c0a5004947

To find the MultiPKFile we just need the 16-bit prefix of that: 8109. Here's the MultiPKFile for that prefix:

% ls -l /var/lib/vesta/cache/sCache/gran-16/81/09
-rw-r--r--  1 vadmin vadmin 577756287 2007-07-30 13:44 /var/lib/vesta/cache/sCache/gran-16/81/09

As you can see, this one is a little large (over 570MB), which is why we're interested in it. We'll dump a verbose text representation of it to a file with PrintMPKFile:

% PrintMPKFile -verbose /var/lib/vesta/cache/sCache/gran-16/81/09 > /tmp/pmpkv.8109

The part we're interested in is the serialized SDL values stored as chunks of bytes. We can find those with a simple grep:

% grep 'bytes = ' /tmp/pmpkv.8109
  bytes = 00000003 00020000 00480003 00000001 00096b65 79... (1517811 total)
  bytes = 00000003 00020000 00480003 00000001 00096b65 79... (1163361 total)
  bytes = 00000003 00020000 00480003 00000001 00096b65 79... (1850775 total)
  bytes = 00000003 00020000 00480003 00000001 00096b65 79... (1488208 total)
...

These are pretty large too (11-18MB). With a little Perl on the command-line we'll add up the total of all those bytes:

% grep 'bytes = ' /tmp/pmpkv.8109 | perl -e '$x = 0; while(<>) { if(/\((\d+) total\)$/) { $x += $1; } }; print($x, "\n");'
497562938

And if we want to see it as a fraction, we can just divide the total by the size of the whole MultiPKFile:

% grep 'bytes = ' /tmp/pmpkv.8109 | perl -e '$x = 0; while(<>) { if(/\((\d+) total\)$/) { $x += $1; } }; print(($x/577756287), "\n");'
0.861198656242403

Here's another example of the same thing with a different file that shows a different ratio:

% ls -l /var/lib/vesta/cache/sCache/gran-16/f0/a4
-rw-r--r--  1 vadmin vadmin 253621601 2007-07-30 13:44 /var/lib/vesta/cache/sCache/gran-16/f0/a4
% PrintMPKFile -verbose /var/lib/vesta/cache/sCache/gran-16/f0/a4  > /tmp/pmpkv.f0a4
% grep 'bytes = ' /tmp/pmpkv.f0a4  | perl -e '$x = 0; while(<>) { if(/\((\d+) total\)$/) { $x += $1; } }; print($x, "\n", ($x/253621601.0), "\n");'
104042972
0.410229142903329