나는 우분투 14.04를 php 5.5와 아파치 2.4로 설정했다.Laravel 5.2 긴 경로가있는 높은 CPU 수
새로운 laravel 5.2가 설치되었습니다. 프로젝트에 데이터베이스 연결이 없습니다.
/HTTP/routes.php하고 편집 앱 때 나는 다음 : 그러니까 기본적으로
Route::get('/', function() {
return view('welcome');
});
Route::get('/test/direct', function() {
return view('welcome');
});
난 그냥 환영보기를 보여주는 두 경로가 있습니다.
나는 그 실행
이ab -n 9999999 -t 300 -c 30 http://xxxxx/laravel52/public
CPU가 6 %를 넘어 결코 나는 다음과 같은 결과를 얻을 : 즉시
ab -n 9999999 -t 300 -c 30 http://xxxxx/laravel52/public/test/direct
는 CPU :
Server Software: Apache/2.4.7
Server Hostname: xxxxx
Server Port: 80
Document Path: /laravel52/public
Document Length: 328 bytes
Concurrency Level: 30
Time taken for tests: 146.271 seconds
Complete requests: 50000
Failed requests: 0
Non-2xx responses: 50000
Total transferred: 28550000 bytes
HTML transferred: 16400000 bytes
Requests per second: 341.83 [#/sec] (mean)
Time per request: 87.763 [ms] (mean)
Time per request: 2.925 [ms] (mean, across all concurrent requests)
Transfer rate: 190.61 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 15 47 77.0 40 3157
Processing: 17 41 28.1 37 2140
Waiting: 17 40 26.9 37 2140
Total: 40 87 84.3 78 3208
Percentage of the requests served within a certain time (ms)
50% 78
66% 83
75% 86
80% 89
90% 100
95% 120
98% 162
99% 228
100% 3208 (longest request)
내가 다음 실행을 결국 100 %까지 올라가고 결과는 다음과 같습니다.
Server Software: Apache/2.4.7
Server Hostname: xxxxx
Server Port: 80
Document Path: /laravel52/public/test/direct
Document Length: 1023 bytes
Concurrency Level: 30
Time taken for tests: 300.001 seconds
Complete requests: 11888
Failed requests: 0
Total transferred: 24585740 bytes
HTML transferred: 12161424 bytes
Requests per second: 39.63 [#/sec] (mean)
Time per request: 757.070 [ms] (mean)
Time per request: 25.236 [ms] (mean, across all concurrent requests)
Transfer rate: 80.03 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 4 12 29.4 8 1020
Processing: 75 740 790.0 609 14045
Waiting: 74 738 789.9 608 14043
Total: 88 752 789.4 622 14050
Percentage of the requests served within a certain time (ms)
50% 622
66% 835
75% 952
80% 1020
90% 1237
95% 1536
98% 2178
99% 2901
100% 14050 (longest request)
루트 루트가 아닌 경우 laravel은 연결이 많은 경우 CPU가 급증하는 것 같습니다. 이것은 또한 laravel 4.2에 새로 설치 한 경우에도 발생합니다.
왜 이런 일이 발생하는지 지적 해 줄 수 있습니까? 나는 이것을 해결할 필요가 정말로있다.
내 서버에는 8GB RAM이 장착 된 8 코어 Intel (R) Core (TM) i7-4771 CPU @ 3.50GHz가 있습니다.
감사합니다.
안녕하세요 @ Malta, 문제를 해결하지 못했습니다. 여전히 남아 있습니다. 환영보기를 반환하는 1 개의 메소드가있는 컨트롤러를 만들었습니다. 'TestController @ showWelcome'에 2 개의 경로를 매핑했습니다. Ran'php artisan route :: cache'와'php artisan optimize'입니다. 더 많거나 적은 동일한 결과를 얻었습니다. –