OpCache-Magento2에 대한 권장 구성


10

Magento 2 스택으로 작업 중이며 일부 Magento 1 OpCache 구성을 재사용하고 있습니다. 나는 이미 주석을 활성화해야한다는 것을 이미 알고 있었지만 다른 값을 향상시킬 수 있다고 확신하므로 현재 구성은 다음과 같습니다.

[opcache]
opcache.enable=1
opcache.enable_cli=0
opcache.memory_consumption=256
opcache.interned_strings_buffer=12
opcache.max_accelerated_files=65406 // thanks Mage2.Pro!
;opcache.max_wasted_percentage=5
;opcache.use_cwd=1
opcache.validate_timestamps=0
;opcache.revalidate_freq=2
;opcache.revalidate_path=0
;opcache.save_comments=0
;opcache.load_comments=0
opcache.fast_shutdown=1
opcache.enable_file_override=1
;opcache.optimization_level=0xffffffff
;opcache.inherited_hack=1
;opcache.dups_fix=0
;opcache.blacklist_filename=
;opcache.max_file_size=0
;opcache.consistency_checks=0
;opcache.force_restart_timeout=180
opcache.error_log=/var/log/php5/php5-opcache.error.log
opcache.log_verbosity_level=3
;opcache.preferred_memory_model=
;opcache.protect_memory=0

참고 : 나는 모든 사람에게 유용하게하기 위해 모든 좋은 대답으로 질문의 구성 블록을 열었으며 (열린 동안) 사이트 규칙에 대한 문제가 있거나 사이트 규칙을 위반하는 경우 반복 제안을 피할 것입니다. 바로 알려주세요.


CLI에서 opcache를 활성화하지 않는 이유는 무엇입니까?
MagePsycho

답변:


13

opcache.max_accelerated_files=16000Magento 2의 경우 분명히 낮 습니다. 폴더에 생성 된 코드 와 일부 외부 확장이 설치된 Magento 2 설치를
find . -type f -print | xargs grep "<?php" | wc -l제공합니다 . 서버에 단일 Magento 2 설치가 있고 다른 PHP 사이트가없는 경우로 설정 하는 것이 좋습니다 . 서버에 여러 개의 PHP 사이트가있는 경우 값을 고려하십시오 .30736var/generation
opcache.max_accelerated_files65406
130986


0

나는 또한 php7에 추가 된 다음 설정을 포함하는 것이 좋습니다

; Allows calling OPcache API functions only from PHP scripts which path is
; started from specified string. The default "" means no restriction
;opcache.restrict_api=

; Mapping base of shared memory segments (for Windows only). All the PHP
; processes have to map shared memory into the same address space. This
; directive allows to manually fix the "Unable to reattach to base address"
; errors.
;opcache.mmap_base=

; Enables and sets the second level cache directory.
; It should improve performance when SHM memory is full, at server restart or
; SHM reset. The default "" disables file based caching.
;opcache.file_cache=

; Enables or disables opcode caching in shared memory.
;opcache.file_cache_only=0

; Enables or disables checksum validation when script loaded from file cache.
;opcache.file_cache_consistency_checks=1

; Implies opcache.file_cache_only=1 for a certain process that failed to
; reattach to the shared memory (for Windows only). Explicitly enabled file
; cache is required.
;opcache.file_cache_fallback=1

; Enables or disables copying of PHP code (text segment) into HUGE PAGES.
; This should improve performance, but requires appropriate OS configuration.
;opcache.huge_code_pages=1
당사 사이트를 사용함과 동시에 당사의 쿠키 정책개인정보 보호정책을 읽고 이해하였음을 인정하는 것으로 간주합니다.
Licensed under cc by-sa 3.0 with attribution required.