제 라라벨이 이렇게 느릴 수가 없어요.
환경 (기초)
환경 차이
비교 방법
전에도 이런 기사를 쓴 적이 있다.
저 아파치 벤치 처음 써봐요.
OPcache 없음
php.ini(예제 설정)
[opcache]
opcache.enable = 0
$ ab -n 1000 -c 100 http://127.0.0.1/
This is ApacheBench, Version 2.3 <$Revision: 1843412 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Completed 1000 requests
Finished 1000 requests
Server Software: nginx/1.17.8
Server Hostname: 127.0.0.1
Server Port: 80
Document Path: /
Document Length: 2426 bytes
Concurrency Level: 100
Time taken for tests: 18.432 seconds
Complete requests: 1000
Failed requests: 0
Total transferred: 3446000 bytes
HTML transferred: 2426000 bytes
Requests per second: 54.25 [#/sec] (mean)
Time per request: 1843.175 [ms] (mean)
Time per request: 18.432 [ms] (mean, across all concurrent requests)
Transfer rate: 182.58 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 1 2.5 0 22
Processing: 79 1744 326.5 1836 2038
Waiting: 69 1743 326.6 1834 2038
Total: 83 1745 324.6 1836 2039
Percentage of the requests served within a certain time (ms)
50% 1836
66% 1865
75% 1883
80% 1894
90% 1926
95% 1948
98% 1988
99% 2009
100% 2039 (longest request)
54.25
18.432 (ms)
OPcache 있음, 사전 로드 없음
php.ini(예제 설정)
[opcache]
opcache.enable = 1
opcache.memory_consumption = 128
opcache.interned_strings_buffer = 8
opcache.max_accelerated_files = 4000
opcache.validate_timestamps = 0
opcache.huge_code_pages = 0
$ ab -n 1000 -c 100 http://127.0.0.1/
This is ApacheBench, Version 2.3 <$Revision: 1843412 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Completed 1000 requests
Finished 1000 requests
Server Software: nginx/1.17.8
Server Hostname: 127.0.0.1
Server Port: 80
Document Path: /
Document Length: 2426 bytes
Concurrency Level: 100
Time taken for tests: 3.318 seconds
Complete requests: 1000
Failed requests: 0
Total transferred: 3446000 bytes
HTML transferred: 2426000 bytes
Requests per second: 301.41 [#/sec] (mean)
Time per request: 331.772 [ms] (mean)
Time per request: 3.318 [ms] (mean, across all concurrent requests)
Transfer rate: 1014.32 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 2 4.4 1 24
Processing: 31 316 60.1 319 481
Waiting: 9 311 59.3 316 461
Total: 34 318 57.9 320 483
Percentage of the requests served within a certain time (ms)
50% 320
66% 335
75% 346
80% 354
90% 381
95% 404
98% 413
99% 421
100% 483 (longest request)
301.41
3.318 (ms)
54.25
부터 301.41
까지의 속도가 약 5.55배 높아졌습니다!!압도적인 속도!!현금 효과 무서워!!
OPcache 있음, 사전 로드됨
php.ini(예제 설정)
[opcache]
opcache.enable = 1
opcache.memory_consumption = 128
opcache.interned_strings_buffer = 8
opcache.max_accelerated_files = 4000
opcache.validate_timestamps = 0
opcache.huge_code_pages = 0
opcache.preload = /var/www/preload.php
opcache.preload_user = www-data
이preload.php 참조.ignore에 몇 개 추가했어요.그냥 써봤는데 내용이 정리되면 다른 일을 하고 싶어요.
$ ab -n 1000 -c 100 http://127.0.0.1/
This is ApacheBench, Version 2.3 <$Revision: 1843412 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Completed 1000 requests
Finished 1000 requests
Server Software: nginx/1.17.8
Server Hostname: 127.0.0.1
Server Port: 80
Document Path: /
Document Length: 2426 bytes
Concurrency Level: 100
Time taken for tests: 2.878 seconds
Complete requests: 1000
Failed requests: 0
Total transferred: 3446000 bytes
HTML transferred: 2426000 bytes
Requests per second: 347.40 [#/sec] (mean)
Time per request: 287.850 [ms] (mean)
Time per request: 2.878 [ms] (mean, across all concurrent requests)
Transfer rate: 1169.09 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 1 1.3 0 7
Processing: 49 268 46.5 275 344
Waiting: 35 267 46.5 274 342
Total: 54 269 45.5 276 344
Percentage of the requests served within a certain time (ms)
50% 276
66% 287
75% 294
80% 298
90% 312
95% 322
98% 331
99% 335
100% 344 (longest request)
347.40
2.878 (ms)
301.41
부터 347.40
까지 약 1.15배 빨라졌습니다!!다시는 내 라라벨이 너무 느리다고 말하지 않을게...!!!
총결산
# OPcacheなし
Requests per second: 54.25 [#/sec] (mean)
Time per request: 18.432 [ms] (mean, across all concurrent requests)
# OPcacheあり、プリロードなし
Requests per second: 301.41 [#/sec] (mean)
Time per request: 3.318 [ms] (mean, across all concurrent requests)
# OPcacheあり、プリロードあり
Requests per second: 347.40 [#/sec] (mean)
Time per request: 2.878 [ms] (mean, across all concurrent requests)
아무것도 설정되지 않은 상태54.25
부터 347.40
까지 약 6.4배의 극적인 고속화를 완성했다!!!PHP의 잠재력이 대단하다!!!
첫 프리셋이라 여러 가지 문제가 생길 수 있는데 문제가 있으면 다시 보도하고 싶어요.😃
Reference
이 문제에 관하여(제 라라벨이 이렇게 느릴 수가 없어요.), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/ucan-lab/items/850bfd3afd3cc0fff60f텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)