php - How to configure APC for many sites? -
php - How to configure APC for many sites? -
we're running many sites on 1 machine, apc.shm = 4g
. not sufficient in caching everything, set apc.ttl= 600
unused entries evicted. it's not clear if working planned. see cache nail rate of ~91%, 100% fragmentation quickly.
we started seeing php go unresponsive requires apache restart, nil logged in php or apache logs. apache can still serve static files without issue during time. gut tells me related churn @ apc in way. here current settings:
apc.cache_by_default 1 apc.canonicalize 0 apc.coredump_unmap 0 apc.enable_cli 0 apc.enabled 1 apc.file_md5 0 apc.file_update_protection 2 apc.filters apc.gc_ttl 3600 apc.include_once_override 0 apc.lazy_classes 0 apc.lazy_functions 0 apc.max_file_size 1m apc.mmap_file_mask /dev/zero apc.num_files_hint 1024 apc.preload_path apc.report_autofilter 0 apc.rfc1867 0 apc.rfc1867_freq 0 apc.rfc1867_name apc_upload_progress apc.rfc1867_prefix upload_ apc.rfc1867_ttl 3600 apc.serializer default apc.shm_segments 1 apc.shm_size 4g apc.slam_defense 1 apc.stat 1 apc.stat_ctime 0 apc.ttl 600 apc.use_request_time 1 apc.user_entries_hint 4096 apc.user_ttl 7200 apc.write_lock 1
a couple of questions:
we modified apc.ttl
did not alter apc.gc_ttl @ same time. lowering value help clear files out more , cut down fragmentation?
would improve off leaving apc.ttl = 0
, allow apc empty , rebuild every time cache fills?
thanks in advance!
apc.num_files_hint 1024
this directive tells apc how many php files have maintain in cache.
it used hash key, making prime number recommended it not plenty if have cache 4gb of php files ! (shared hosting guess)so please start putting bigger figure here, prime number bigger value :
find /var/www -type f -name "*.php" |wc -l
you may have chance understand what's going on stracing apache process handling php scripts when apache goes unresponsive, using
strace -tt -o output.txt <pid of apache>
find pid using server-status page.
php apc
Comments
Post a Comment