What does apc.mmap_file_mask really do?

Solution 1:

Have you tried APC.php on the active web server? if you are using SHM and not MMAP that could explain this. The filemask simply allows it to save the ap file with random digits as per your specification to a particular location. You can even send it to /dev/zero as per a blog post here http://www.nigeldunn.com/2011/05/02/unable-to-allocate-memory-pool/

Here is explanation of various memory/file locations https://stackoverflow.com/questions/904581/shmem-vs-tmpfs-vs-mmap

I am not entirely certain of my answer but it is plausible that you are using SHM and hence the parameter for mmap mask may not apply.

try this as well after laoding your APC.php

ls /dev/shm

Solution 2:

In case it's useful to anyone, the files get deleted almost immediately which is why you can't see them via ls (unless you happen to run ls just at the right second). If you'd like to see files being created and deleted by APC in the directory specified by apc.mmap_file_mask, you can use inotify-tools to monitor filesystem activity in that directory.

Just install it and change to the apc.mmap_file_mask directory and run the following command. If other processes use that directory for other things (such as in the case of /tmp), you can pipe the output to grep and look for part of the filename that matches your mmap_file_mask setting such as 'apc.'

/usr/bin/inotifywait -mr -e attrib,create,delete,modify,move --format '|%w/%f| %e %T' --timefmt '%Y-%m-%d-%H-%M-%S' .

#example output:

Setting up watches.  Beware: since -r was given, this may take a while!
Watches established.
|.//apc.wi3mjq| CREATE 2014-07-09-20-59-01
|.//apc.wi3mjq| MODIFY 2014-07-09-20-59-01
|.//apc.wi3mjq| DELETE 2014-07-09-20-59-01
|.//apc.EQs3Up| CREATE 2014-07-09-20-59-01
|.//apc.EQs3Up| MODIFY 2014-07-09-20-59-01
|.//apc.EQs3Up| DELETE 2014-07-09-20-59-01
|.//apc.IpNU5o| CREATE 2014-07-09-20-59-01
|.//apc.IpNU5o| MODIFY 2014-07-09-20-59-01
|.//apc.QnNU5o| CREATE 2014-07-09-20-59-01
|.//apc.QnNU5o| MODIFY 2014-07-09-20-59-01
|.//apc.QnNU5o| DELETE 2014-07-09-20-59-01

As a side note, this trick works for seeing temporary table activity in MySQL's tmpdir as well.