Я установил ubuntu 14.04 с php 5.5 и apache 2.4.Laravel 5.2 Высокий процессор с длинными маршрутами
Я установил свежий laravel 5.2. В проекте нет подключений к базе данных.
Я тогда, когда приложение/Http/routes.php и отредактировано:
Route::get('/', function() {
return view('welcome');
});
Route::get('/test/direct', function() {
return view('welcome');
});
Так в основном у меня есть 2 маршрута только с указанием приветственного вида.
Я затем запустить:
ab -n 9999999 -t 300 -c 30 http://xxxxx/laravel52/public
Cpu никогда не выходит более чем на 6%, и я получаю следующие результаты:
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)
Я тогда бежать:
ab -n 9999999 -t 300 -c 30 http://xxxxx/laravel52/public/test/direct
В Cpu сразу доходит до 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 шипит процессор, если есть много соединений. Это также происходит со свежей установкой в laravel 4.2.
Может ли кто-нибудь указать, почему это происходит? Мне действительно нужно это решить.
У моего сервера 8-ядерный процессор Intel (R) Core i7-4771 @ 3,50 ГГц с 8 ГБ оперативной памяти.
Спасибо.
Привет @ Малта, это не решило проблему. Это все еще остается. Создал контроллер с 1 методом, который возвращает приветственный вид. Набрал 2 маршрута, которые мне пришлось на «TestController @ showWelcome». Ran 'php artisan route :: cache' и' php artisan optimize'. Получены более или менее одинаковые результаты. –