Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have slow response issue on my debian 6 + nginx + apc 3.1.9 + php-fpm 5.3.10 server. My website is based on symfony 1.4.

My setup is VPS with 512MB ram which is almost everytime used up to 250MB. This happens only if i has APC switched on. Without APC caching has website slower responses but it behave stable.

When i switch APC on, Some about 1/20 request behave like it wait for some files unlock or something like that and response is sent about 5-6s later. (Common responses on the same requests are served in about 100ms) I have this APC setup:

extension=apc.so

apc.enabled="1"
apc.shm_size="32M"
apc.num_files_hint = 100
apc.ttl="7200"
apc.gc_ttl="600"
apc.cache_by_default="1"
apc.filters = "apc\.php$,apc_clear\.php$"
apc.canonicalize="0"
apc.mmap_file_mask="/tmp/apc-php5.XXXXXX"
apc.enable_cli="0"
apc.max_file_size = 5M
apc.report_autofilter="0"
apc.include_once_override="0"
apc.write_lock="0"

apc.stat="0"

fpm is multithread just like nginx, so i taught its locked session files, ok, moved sessions into memcache - website is much faster (about 50ms in average), but the strange behaviour with sometimes very long responses remains.

Iam logging slow responses (threshold is 3s) in fpm and catch some of them:

config_core_compile.yml.php:3851 mentioned in second log contains just require $path with valid path to existing php file.

(the firstone tooked about 20s!)

[15-Feb-2012 13:39:12]  [pool www] pid 2205
script_filename = /www/www.site.com/current/web/index.php
[0x0000000001d415f0] session_start() /www/www.site.com/releases/20120214220306/cache/frontend/prod/config/config_core_compile.yml.php:3779
[0x0000000001d41410] initialize() /www/www.site.com/releases/20120214220306/cache/frontend/prod/config/config_core_compile.yml.php:1507
[0x0000000001d3f0e0] __construct() /www/www.site.com/releases/20120214220306/cache/frontend/prod/config/config_factories.yml.php:114
[0x0000000001d3ea38] +++ dump failed

[15-Feb-2012 12:39:00]  [pool www] pid 2186
script_filename = /www/www.site.com/current/web/index.php
[0x0000000001b80670] renderFile() /www/www.site.com/releases/20120214220306/cache/frontend/prod/config/config_core_compile.yml.php:3851
[0x0000000001b7f820] renderFile() /www/www.site.com/releases/20120214220306/lib/vendor/symfony/view/sfPartialView.class.php:124
[0x0000000001b7f138] render() /www/www.site.com/releases/20120214220306/lib/vendor/symfony/helper/PartialHelper.php:220
[0x0000000001b7f040] get_partial() /www/www.site.com/releases/20120214220306/lib/vendor/symfony/helper/PartialHelper.php:182
[0x0000000001b7ebe0] include_partial() /www/www.site.com/releases/20120214220306/apps/frontend/modules/hotel/templates/_list_tabs_boxmain.php:8
[0x0000000001b7e770] +++ dump failed

The strange is that it happens only sometimes...

share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

Found it..

It was because of apc.mmap_file_mask set into "straight file-backed mmap" like said oficial APC doc. Since server setup is multithreaded and apc was stored in fysical file, it was stucking by the reason of locked file.

Its very important to set it into shared memory.

So now my apc.ini is:

apc.gc_ttl="600"
apc.cache_by_default="1"
apc.filters = "apc\.php$,apc_clear\.php$"
apc.canonicalize="0"
apc.mmap_file_mask=/apc.shm.XXXXXX
apc.enable_cli="0"
apc.max_file_size = 5M
apc.report_autofilter="0"
apc.include_once_override="0"

apc.stat="0"
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.