lighttpd forum XCache > xcache.mmap_path Setting

Posted by Sam (Guest)
on 27.07.2008 01:16
I don't understand what the xcache.mmap_path setting is used for.

What is the difference between setting it to "/tmp/xcache" vs. setting 
it to "/dev/zero"? (I seem to be getting better performance with the 
latter.)

xcache is installed on a quad-core system, so I have xcache.count = 4.

What should I set xcache.mmap_path to? (This is on a Red Hat Linux 
system.)

Thanks,

Sam
Posted by moo XCache
on 27.07.2008 01:45
Sam wrote:
> I don't understand what the xcache.mmap_path setting is used for.
> 
> What is the difference between setting it to "/tmp/xcache" vs. setting 
> it to "/dev/zero"? (I seem to be getting better performance with the 
> latter.)
both way leads to anonymous shared memory
 a. XCache create("/tmp/xcache"), mmap("/tmp/xcache") twice to get 
readonlyprotection feature, and then unlink("/tmp/xcache") to make it 
anonymous, or
 b. XCache mmap("/dev/zero"), no readonlyprotection is possible
see http://xcache.lighttpd.net/wiki/ReadonlyProtection
/dev/zero is a quick and easy way but not all system support it. 
/tmp/xcache is an alternative way that you'll have readonlyprotection 
feature, but make sure you have /tmp directory so XCache can create file 
in it. e.g. when you chroot, you might forget to create /tmp

no difference except readonlyprotection feature, so which ever is fine
Posted by Guest (Guest)
on 27.07.2008 03:06
> Sam wrote:
>> I don't understand what the xcache.mmap_path setting is used for.
>> 
>> What is the difference between setting it to "/tmp/xcache" vs. setting 
>> it to "/dev/zero"? (I seem to be getting better performance with the 
>> latter.)
> both way leads to anonymous shared memory
>  a. XCache create("/tmp/xcache"), mmap("/tmp/xcache") twice to get 
> readonlyprotection feature, and then unlink("/tmp/xcache") to make it 
> anonymous, or
>  b. XCache mmap("/dev/zero"), no readonlyprotection is possible
> see http://xcache.lighttpd.net/wiki/ReadonlyProtection
> /dev/zero is a quick and easy way but not all system support it. 
> /tmp/xcache is an alternative way that you'll have readonlyprotection 
> feature, but make sure you have /tmp directory so XCache can create file 
> in it. e.g. when you chroot, you might forget to create /tmp
> 
> no difference except readonlyprotection feature, so which ever is fine

Thanks for the explanation. So, when xcache.mmap_path="/dev/zero", 
readonlyprotection is disabled (event though it shows set to "1" in 
phpinfo())?

Is there a performance penalty for readonlyprotection? Does that explain 
why I get better performance when xcache.mmap_path="/dev/zero" (because 
readonlyprotection is disabled)?

What about using xcache.mmap_path="/dev/shm/xcache" - would that work as 
well?

Thanks again,

Sam
Posted by moo XCache
on 28.07.2008 02:32
> Thanks for the explanation. So, when xcache.mmap_path="/dev/zero", 
> readonlyprotection is disabled (event though it shows set to "1" in 
> phpinfo())?
showing 1 means it is set to "on" in ini, but it is not available

> 
> Is there a performance penalty for readonlyprotection? Does that explain 
yep, fast(shadow/shallow) copying of opcodes is unavailable when 
readonlyprotection is on
> why I get better performance when xcache.mmap_path="/dev/zero" (because 
> readonlyprotection is disabled)?
no, i don't know why

> What about using xcache.mmap_path="/dev/shm/xcache" - would that work as 
> well?
i haven't tried that yet but i guess so. if it starts up and works, u 
can assume it stable. there won't be anyting weird in futher