Those response times are really high. If i add the above route to my current project using valet it takes about 15-20ms to respond. My first guess, do you have xdebug turned on? If so, turn it off and try again.
Jan 3, 2020
13
Level 3
Execution time issues on server. ( 150 ms average localhost vs 300 ms average on live server )
Hello,
Recently I made a eCommerce website using laravel as api. Everything is working fine but there is one thing bothering me. In my live server the average request is 300 ms , and in localhost is 150 ms [average] - Takes twice the time. I can't understand why that happens.
- I downloaded the exact same project to my localhost ,
- Set up the database to be connected to the live project ( Instead of the localhost in the env file, I put the IP address of the live server ) ,
- The same thing happens.
Also I used an PHP BENCHMARK SCRIPT and the results are :
- Live Server
Start : 2020-01-03 23:19:12
PHP version : 7.3.13
Platform : Linux
--------------------------------------
test_ifelse : 0.160 sec.
test_loops : 0.238 sec.
test_stringmanipulation : 0.349 sec.
test_math : 0.252 sec.
--------------------------------------
Total time: : 0.999 sec.
- Localhost Server :
Start : 2020-01-04 00:19:48
Server : localhost@::1
PHP version : 7.3.12
Platform : WINNT
--------------------------------------
test_math : 0.275 sec.
test_stringmanipulation : 1.686 sec.
test_loops : 0.610 sec.
test_ifelse : 0.369 sec.
--------------------------------------
Total time: : 2.94 sec.
Example :
Localhost : Query with 855 results : 164 ms
Live Server : Query with 855 results : 338 ms
Version : 6.0.4
Running this piece of code :
Route::get('/testing', function() {
return "Testing";
});
- Live Server : 321 ms
- Localhost : 114 ms
Please or to participate in this conversation.