Date post: | 18-May-2015 |
Category: |
Technology |
Upload: | alex-raskin |
View: | 258 times |
Download: | 0 times |
APCSome useful tuning
2 caching mechanism
Memory cache for long operations and calculations
Opcode cache for skipping code interpretation
Opcode
The Vulcan Logic Disassembler
Tuning opcode cache
apc.max_file_size (1M)Files bigger then that wouldn't be cached.
apc.num_files_hint (1000)Number of files that will be cached. Increase it.
apc.file_md5 (0)Keep it 0, it's a lie
apc.ttl (0)How long the file will stay cached
Tuning opcode cache
apc.stat (1)Rechecking if file was updated. Set it to 0.
Tuning opcode cache
strace -e trace=file httpd -X
Tuning opcode cache
apc.stat (1)Rechecking if file was updated. Set it to 0.
apc.slam_defense (1)Prevents mass caching on startup. Set to 0
apc.write_lock (1)Prevents locking of parallel requests
apc.file_update_protection (2)Seconds to wait before new file gets cached
Extra control on opcode caching
apc.filter (null)Regexp: cache only matching it files.
apc.cache_by_default (1)Caches all php files. If set to 0 - it would use the filter
apc.canonicalize (1)Convert relative path's into canonical. Set to 0 and always use absolute path's.
Now User Cache
Concurrent lockingFile locksBasic locking mechanism. Very slow.
IPC Semaphore locksSemaphores (provided by the OS). Better then file locks
Linux Futex locksLinux specific mechanism. Significant gain. ( user space )
Pthread mutexesAlmost same as futex ( kernel space)
Spin locksExtremely fast. Ported from Postgres. Eats your cpu
Use igbinarySerialization sucksExample array: [1,2,'hi']
Use igbinary
Apc constants
Regular defines are uber slow
Prime cache before start
Preload cache with data before going public
apc_store()apc_compile_file()