OPcache, PHP bytecode'unu bellekte cache'leyerek her istekte script'in yeniden compile edilmesini önler. Production ortamında OPcache etkin olmadan PHP uygulaması deploy edilmemelidir — tipik olarak %30–50 yanıt süresi iyileşmesi sağlar.
Temel php.ini yapılandırması: `opcache.enable=1`, `opcache.memory_consumption=256` (MB), `opcache.max_accelerated_files=20000`, `opcache.interned_strings_buffer=16`. Yüksek trafikli sitelerde memory_consumption 512 MB'a çıkarılabilir.
Production kritik ayar: `opcache.validate_timestamps=0` — deploy sonrası PHP-FPM restart gerekir ancak disk I/O overhead ortadan kalkar. Deploy pipeline'ında `systemctl reload php8.2-fpm` otomatik çalıştırılmalıdır. Development ortamında validate_timestamps=1 bırakılır.
Laravel optimizasyonu: deploy sonrası `php artisan config:cache`, `route:cache`, `view:cache` çalıştırılır. OPcache ile birlikte bootstrap süresi minimize edilir. WordPress için object cache (Redis) + OPcache kombinasyonu en iyi performansı sağlar.
Monitoring: `opcache_get_status()` ile hit rate, memory usage ve cached scripts izlenir. Hit rate %99 altına düşerse memory_consumption artırılmalı veya gereksiz PHP dosyaları temizlenmelidir. OPcache GUI (opcache-gui) görsel dashboard sağlar.
BulutX sunucular PHP 8.2+ OPcache, PHP-FPM tuning ve Redis object cache kurulumu destekler. PHP projeniz için teklif alın.
İlgili hizmet
Detayları incele