Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I want to use APC in a shared environment, but the main problem is of course, opcode sharing.

To overcome this, I've thought about using different apc.mmap_file_mask for each user (they're chrooted through php-fpm), so the "file" created by APC would not be shared, but would be personal to the user.

Of course, I've noticed I'm wrong for serveral reasons... and the biggest one is about "What does really do apc.mmap_file_mask?": I've thought it was like a pointer to the memory region used by APC, but i'm not that sure about it.
And, of course, there is no file in the path I've used (/tmp/apc.XXXXXX): no file on the machine's /tmp, and no file in the chrooted environment's (/home/vhosts/0001/tmp).
So, what does really do apc.mmap_file_mask?

My actual configuration is:

apc.mmap_file_mask = /tmp/apc.XXXXXX
apc.num_files_hint = 2048
apc.max_file_size = 10M
apc.ttl = 7200

I've already checked what happens with phpinfo(), and it doesn't translate the value: it still gives me /tmp/apc.XXXXXX (but apc.php says the cache was hit and I have better timing values... thus it is working).

share|improve this question
add comment

1 Answer

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 http://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
share|improve this answer
    
There is no file created in /dev/shm, and no files are present in /tmp like it should be according to my configuration. So, the problem remains... but the link you provided (at nigeldunn.com) looks to be really interesting since my configuration seems to be screwed up as well (apc.php says "100% fragmentation"), so I'm gonna fix it with his advices (so, thanks about it! :) ). I'll try some experimentations about mmapping files, and let you know what happens! :P –  Alessio Periloso Jul 4 '12 at 3:49
1  
Okay, after having tested it for a while I can say: nothing happens. No files are created anywhere, and everything seems to be allocated just into the ram. –  Alessio Periloso Mar 26 '13 at 15:20
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.