lighttpd forum XCache > XCache for CGI: Use memcached to store the opcodes?

Posted by Raphael Vullriede
on 01.07.2008 09:37
Hi,

Today all opcode caches work only with php as an module or with a 
FastCGI setup because only in this cases the compiled opcodes can be 
reused.
Unfortunately many hosters allow only CGI setups for security and 
stability reasons. If you want to use an opcode cache in such a setup 
you need an way to store the opcodes outside the current process so that 
they survive the process termination and can be read by the next 
process.

With memcached there already exists a fast and stable in memory cache. 
So that is my idea: Let XCache do its work but optionally use memcached 
as memory backend for CGI setups.  I know it will be slower than writing 
direct to memory but I think for large applications (e.g. symfony + 
doctrine) it could be faster than compiling all files in every request.

What do you think? Does it make sense and is it possible?

Regards,
Raphael
Posted by moo XCache
on 02.07.2008 02:25
Raphael Vullriede wrote:
> Hi,
> 
> Today all opcode caches work only with php as an module or with a 
> FastCGI setup because only in this cases the compiled opcodes can be 
> reused.
> Unfortunately many hosters allow only CGI setups for security and 
> stability reasons. If you want to use an opcode cache in such a setup 
> you need an way to store the opcodes outside the current process so that 
> they survive the process termination and can be read by the next 
> process.
cgi and suphp (which is also a cgi) is less but still commonly used and 
its performance is a big issue. as it's slow already, i'm not sure if 
opcode cacher help much.
i'm not sure if it work nice, but mpm_perchild is the best model that 
balance security and performance issue.
> What do you think? Does it make sense and is it possible?
it is possible, but requires so many coding. no pointers can be stored 
in stream-alike form so every pointers need to be converted to offset

it would be nice if someone help me speed up 2.0 schedule
Posted by Raphael Vullriede
on 04.07.2008 18:22
Hi,

thanks for your reply.

moo XCache wrote:
> Raphael Vullriede wrote:
>> Hi,
>> 
>> Today all opcode caches work only with php as an module or with a 
>> FastCGI setup because only in this cases the compiled opcodes can be 
>> reused.
>> Unfortunately many hosters allow only CGI setups for security and 
>> stability reasons. If you want to use an opcode cache in such a setup 
>> you need an way to store the opcodes outside the current process so that 
>> they survive the process termination and can be read by the next 
>> process.
> cgi and suphp (which is also a cgi) is less but still commonly used and 
> its performance is a big issue. as it's slow already, i'm not sure if 
> opcode cacher help much.
> i'm not sure if it work nice, but mpm_perchild is the best model that 
> balance security and performance issue.
>> What do you think? Does it make sense and is it possible?
> it is possible, but requires so many coding. no pointers can be stored 
> in stream-alike form so every pointers need to be converted to offset

I understand. That is too much work for a uncertain performance 
improvement.

> it would be nice if someone help me speed up 2.0 schedule

As much as I would like to help you I think my knowledge of the xcache 
internals is not enough :-(

Regards,
Raphael