mod_fcgid with php opcode caching

北战南征 提交于 2019-12-12 05:48:55

问题


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?


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/4308611/mod-fcgid-with-php-opcode-caching

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!