Question

I have been using apache web server with mpm-worker and mod_fcgid.

I have read about mod_fcgid that it can not make use of opcode caching.

http://www.brandonturner.net/blog/2009/07/fastcgi_with_php_opcode_cache/

apc cache module seems to be enabled in my php configuration.

I am not sure if my spawned php codes are never shared.

Should I remove APC? Does it have any overhead?

Was it helpful?

Solution

I am not sure if my spawned php codes are never shared.

You might find this question helpful.

Should I remove APC? Does it have any overhead?

As for the overhead, if you have n processes, then you'll have n caches. It's not space efficient but it might still help reducing CPU cycles tho.

OTHER TIPS

It does use opcode caching, but the caches are not shared between the PHP processes, so they will be cached once for each process. It's definitely still worth using APC.

Having read the article, I'll throw my own $0.2c in here w/regards to fgcid vs fastcgi. We initially deployed a solution much like that described in the article, using fastcgi and having the PHP process spawn multiple children. This was an attempt to work around the problems of sharing the cache.

However, we experienced periodic complete lockups with this solution; the PHP process would hang and fastcgi would fail to detect it, resulting in our entire app hanging for all users.

We've switched to fcgid again and the lockups ceased entirely. There is some overhead with a cache per process, but fcgid will only spawn new PHP processes when it needs to, so in practice the overhead is minimal.

We also use the user cache with APC, not just the opcode cache, so for us the tradeoff is definitely worth it (cached data means less work on the server, cached opcodes mean less work on the server) so CPU usage is definitely reduced for a slight memory usage penalty.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top