[php] OpCache 설정

Code/PHP 2020. 3. 11. 15:08

12,000개 파일의 라라벨을 하루 가동한 결과

 

* memory usage
total memory: 256.00MB
used memory: 32.53MB
free memory: 221.07MB
wasted memory: 2.39MB (0.94%)

 

* opcache statistics
number of cached files: 982
number of hits: 4,717,114
number of misses: 1,149
blacklist misses: 0
number of cached keys: 1,870
max cached keys: 32,531

 

* interned strings usage
buffer size: 12.00MB
used memory: 3.89MB
free memory: 8.11MB
number of strings: 53,502



//---------------------------------
* php.ini 수정
https://wiki.mikejung.biz/PHP_OPcache


zend_extension=php_opcache.dll

opcache.enable=1
opcache.enable_cli=1
opcache.memory_consumption=128
opcache.interned_strings_buffer=16
opcache.max_accelerated_files=20000
opcache.save_comments=1
;opcache.revalidate_freq=30
;opcache.max_wasted_percentage=10
;opcache.validate_timestamps=0
;opcache.fast_shutdown=0



//-----------------------------
* opcache 캐시 정보 지우기
opcache_reset()

- 커맨드 라인 명령어로는 불가능, php 파일내에서 함수 명령으로만 가능


//-----------------------------
- 라라벨에서 artisan 명령어로 opcache 제어하는 패키지
https://github.com/appstract/laravel-opcache
composer require appstract/laravel-opcache

Clear OPcache:
php artisan opcache:clear

Show OPcache config:
php artisan opcache:config

Show OPcache status:
php artisan opcache:status


//---------------------------------
* GUI

 amnuts/opcache-gui 
https://github.com/amnuts/opcache-gui
composer require amnuts/opcache-gui



//---------------------------------
* 한 페이지 GUI 소스
rlerdorf/opcache-status 
https://github.com/rlerdorf/opcache-status


//--------------------
https://github.com/PeeHaa/OpCacheGUI
composer require peehaa/opcachegui
- 라라벨과 맞지 않음




//----------------------------------------------
// 참고
* Make your Laravel App Fly with PHP OPcache
https://medium.com/appstract/make-your-laravel-app-fly-with-php-opcache-9948db2a5f93#.bjrpj4h1c


반응형
Posted by codens