mod_fcgid processes and XCache lifetime

523 views Asked by At

I use mod_fcgid and Xcache 3.0.3, PHP 5.4.18. I know that due to mod_fcgid design, I can't use a common shared memory, so every php-cgi process uses its own cache during its lifetime.

When I open top and check for php-cgi processes I see this:

PID     USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
14827 examplecom  20   0  230m  34m  18m S 11.0  3.4   0:07.07 php-cgi
14840 examplecom  20   0  242m  45m  18m S  0.7  4.6   0:02.74 php-cgi
14802 examplecom  20   0  237m  41m  18m S  6.3  4.2   0:11.39 php-cgi
14816 examplecom  20   0  232m  36m  18m S  1.7  3.7   0:07.75 php-cgi
14824 examplecom  20   0  231m  34m  18m S  8.6  3.5   0:06.12 php-cgi
14838 examplecom  20   0  229m  33m  17m S  0.7  3.3   0:00.89 php-cgi
14841 examplecom  20   0  228m  32m  18m S  2.0  3.3   0:01.71 php-cgi
14839 examplecom  20   0  228m  32m  18m R  8.6  3.2   0:01.58 php-cgi

Then I check XCache admin panel. Everytime I refresh admin page I see another process' data. For example I see that:

XCache Cacher
XCache Cacher Module    enabled 
Readonly Protection     disabled 
Page Request Time   2013-09-04 21:59:32 
Cache Init Time     2013-09-04 21:59:05 
Cache Instance Id   14827 
Opcode Cache    enabled, 12,582,912 bytes, 1 split(s), with 8192 slots each 
Variable Cache  enabled, 1,048,576 bytes, 1 split(s), with 8192 slots each 
Shared Memory Schemes   mmap 

It seems like process 14827 lives for 27 seconds. But when I check top that process works for 0:07.07.

So does PID 14827 lives for 7 minutes or 27 seconds. Which is correct or do I miss something with the XCache inner workings?

Is it better option to change /etc/httpd/conf.d/fcgid.conf and make each process' lifetime longer ? Or is it bad idea to change default values.

What optimization can I do more to make XCache and mod_fgid work better ? (I don't prefer to change my server to nginx, and migrate to mod_fastcgi)

1

There are 1 answers

0
po_taka On

I don't know XCache, but...

let's say we have 1 apache process 3 php processes

all 3 php processes are running. All 3 have same "running time". // time now is 0000

You request some page. Apache connect to process#1, cache is initiated. // cache init time is 0001

you refresh page. Apache connect to process#2, cache is initiated. // cache init time is 0033

Now you have 3 processes, all 3 are running since time 0000, but

process#1 have initCacheTime 0001

process#2 have initCacheTime 0033

process#3 do not have initatedCacheTime, cuz it is not used yet.