• 돌아가기
  • 아래로
  • 위로
  • 목록
  • 댓글
정보

php 8버전에서 jit 활성화하기

달소 달소 1542

0

4

 

안녕하세요 달소입니다.

이번글은 php 7에서 8로 넘어갔을때 가장 큰 변경점이자 php의 속도향상을 위해서 나온 jit을 활성화하는방법입니다.

 

JIT은 "Just in time"을 의미하며 PHP가 해석 계층의 도움 없이 코드를 기계 코드(CPU가 이해하는 코드)로 직접 컴파일할 수 있음을 의미합니다. CPU를 많이 사용하는 작업의 경우 PHP에서 JIT 컴파일러를 사용하면 성능이 크게 향상됩니다.

 

jit의 경우 opcache를 통해 확장되기 때문에 반드시 php-opcache 를 먼저 설치해주세요.

 

php7.4부터 속도차이

 

 

jit 활성화하기

저같은경우 docker에서 진행했지만 로컬에서 진행하셔도 무방합니다.

 

먼저 php -i 를 이용해서 opcache가 설치되어있는지 확인합니다.

 

php -i | grep 'opcache\.enable '

 

image.png.jpg

 

위처럼 On이 되어있다면 

 

Opcache 설정값을 변경해주시면 됩니다. 아래 명령어로 경로를 확인해주세요

php -i | grep opcache\.ini
/usr/local/etc/php/conf.d/docker-php-ext-opcache.ini,

그리고 위 경로에 들어가서 아래 내용을 추가해주시면됩니다.

 

opcache.enable_cli=1
opcache.jit_buffer_size=100M
opcache.jit=tracing

그리고 php를 한번 재시작 시켜주시고 아래명령어로 적용을 확인해주시면됩니다.

 

끝!

 

php -i | grep -E '^opcache\.(enable_cli|jit|jit_buffer_size) '

opcache.enable_cli => On => On
opcache.jit => tracing => tracing
opcache.jit_buffer_size => 100M => 100M

 

 

jit 관련 설정 참고

 

PHP: Runtime Configuration - Manual The behaviour of these functions is affected by settings in php.ini.OPcache configuration options Name Default Changeable Changelog opcache.enable "1" PHP_INI_ALL   opcache.enable_cli "0" PHP_INI_SYSTEM Between PHP 7.1.2 and 7.1.6 inclusive, the default was "1" opcache.memory_consumption "128" PHP_INI_SYSTEM   opcache.interned_strings_buffer "8" PHP_INI_SYSTEM   opcache.max_accelerated_files "10000" PHP_INI_SYSTEM   opcache.max_wasted_percentage "5" PHP_INI_SYSTEM   opcache.use_cwd "1" PHP_INI_SYSTEM   opcache.validate_timestamps "1" PHP_INI_ALL   opcache.revalidate_freq "2" PHP_INI_ALL   opcache.revalidate_path "0" PHP_INI_ALL   opcache.save_comments "1" PHP_INI_SYSTEM   opcache.fast_shutdown "0" PHP_INI_SYSTEM Removed in PHP 7.2.0 opcache.enable_file_override "0" PHP_INI_SYSTEM   opcache.optimization_level "0x7FFEBFFF" PHP_INI_SYSTEM Changed from 0x7FFFBFFF in PHP 7.3.0 opcache.inherited_hack "1" PHP_INI_SYSTEM Removed in PHP 7.3.0 opcache.dups_fix "0" PHP_INI_ALL   opcache.blacklist_filename "" PHP_INI_SYSTEM   opcache.max_file_size "0" PHP_INI_SYSTEM   opcache.consistency_checks "0" PHP_INI_ALL   opcache.force_restart_timeout "180" PHP_INI_SYSTEM   opcache.error_log "" PHP_INI_SYSTEM   opcache.log_verbosity_level "1" PHP_INI_SYSTEM   opcache.record_warnings "0" PHP_INI_SYSTEM Available as of PHP 8.0.0 opcache.preferred_memory_model "" PHP_INI_SYSTEM   opcache.protect_memory "0" PHP_INI_SYSTEM   opcache.mmap_base null PHP_INI_SYSTEM   opcache.restrict_api "" PHP_INI_SYSTEM   opcache.file_update_protection "2" PHP_INI_ALL   opcache.huge_code_pages "0" PHP_INI_SYSTEM   opcache.lockfile_path "/tmp" PHP_INI_SYSTEM   opcache.opt_debug_level "0" PHP_INI_SYSTEM Available as of PHP 7.1.0 opcache.file_cache NULL PHP_INI_SYSTEM   opcache.file_cache_only "0" PHP_INI_SYSTEM   opcache.file_cache_consistency_checks "1" PHP_INI_SYSTEM   opcache.file_cache_fallback "1" PHP_INI_SYSTEM Windows only. opcache.validate_permission "0" PHP_INI_SYSTEM Available as of PHP 7.0.14 opcache.validate_root "0" PHP_INI_SYSTEM Available as of PHP 7.0.14 opcache.preload "" PHP_INI_SYSTEM Available as of PHP 7.4.0 opcache.preload_user "" PHP_INI_SYSTEM Available as of PHP 7.4.0 opcache.cache_id "" PHP_INI_SYSTEM Windows only. Available as of PHP 7.4.0 opcache.jit "tracing" PHP_INI_ALL Available as of PHP 8.0.0 opcache.jit_buffer_size "0" PHP_INI_SYSTEM Available as of PHP 8.0.0 opcache.jit_debug "0" PHP_INI_ALL Available as of PHP 8.0.0 opcache.jit_bisect_limit "0" PHP_INI_ALL Available as of PHP 8.0.0 opcache.jit_prof_threshold "0.005" PHP_INI_ALL Available as of PHP 8.0.0 opcache.jit_max_root_traces "1024" PHP_INI_SYSTEM Available as of PHP 8.0.0 opcache.jit_max_side_traces "128" PHP_INI_SYSTEM Available as of PHP 8.0.0 opcache.jit_max_exit_counters "8192" PHP_INI_SYSTEM Available as of PHP 8.0.0 opcache.jit_hot_loop "64" PHP_INI_SYSTEM Available as of PHP 8.0.0 opcache.jit_hot_func "127" PHP_INI_SYSTEM Available as of PHP 8.0.0 opcache.jit_hot_return "8" PHP_INI_SYSTEM Available as of PHP 8.0.0 opcache.jit_hot_side_exit "8" PHP_INI_SYSTEM Available as of PHP 8.0.0 opcache.jit_blacklist_root_trace "16" PHP_INI_ALL Available as of PHP 8.0.0 opcache.jit_blacklist_side_trace "8" PHP_INI_ALL Available as of PHP 8.0.0 opcache.jit_max_loop_unrolls "8" PHP_INI_ALL Available as of PHP 8.0.0 opcache.jit_max_recursive_calls "2" PHP_INI_ALL Available as of PHP 8.0.0 opcache.jit_max_recursive_returns "2" PHP_INI_ALL Available as of PHP 8.0.0 opcache.jit_max_polymorphic_calls "2" PHP_INI_ALL Available as of PHP 8.0.0 For further details and definitions of the PHP_INI_* modes, see the Where a configuration setting may be set. from WWW.PHP.NET

 

 

신고공유스크랩
4
profile image
outlaw2 2023.01.18. 04:29
달소
php jit 좀 알아보니 다른건 큰 성능 향상이 있는데 워드프레스에선 jit 효과가 거의 없는걸로...
아쉽네요

댓글 쓰기 권한이 없습니다. 로그인

취소 댓글 등록

cmt alert

신고

"님의 댓글"

이 댓글을 신고하시겠습니까?

댓글 삭제

"님의 댓글"

삭제하시겠습니까?


목록

공유

facebooktwitterpinterestbandkakao story

주간 조회 수 인기글

주간 추천 수 인기글

분류 제목 글쓴이 날짜 조회 추천
코딩테스트 ㅘ!!!!!! 9 Jasons 23.08.24.15:40 140 +2
코딩테스트 으어... 대회 시작 1시간 하고도 정확히 15분전 2 Jasons 23.08.13.12:45 244 +1
코딩테스트 NYPC 2023 2 Jasons 23.08.09.14:13 173 +1
코딩테스트
image
Jasons 23.08.24.15:40 140 +2
코딩테스트
normal
Jasons 23.08.13.12:45 244 +1
코딩테스트
image
Jasons 23.08.09.14:13 173 +1
Python
normal
mjk 23.08.03.20:22 226 +3
Linux
image
hilee0602 23.04.05.16:34 237 +1
Linux
image
화정큐삼 23.03.19.08:46 304 0
Docker
normal
장작_범댕이 23.02.19.14:21 299 0
정보
image
동기 23.01.16.09:16 220 0
정보
image
달소 23.01.06.14:50 1542 0
정보
image
동기 23.01.04.16:14 206 +2