Hirog's avatar
Level 1

Laravel 8 Slow first load

Hello,

I have an issue on my dedicated server with apache. When I open a laravel website, it's slow the first time someone hits the site after a period of no activity and after it's fast for everyone. Do you know this issue ? I use mySQL and I have 7 website under laravel on this server with the same achitecture. Can you help me please ?

0 likes
7 replies
tisuchi's avatar

@hirog Now the question is how slow is that?

It's normal behavior that the application takes a bit longer time during loading the first time. Have you checked if that is because of a slow query or N+1? Maybe check with debugbar package

Hirog's avatar
Level 1

@tisuchi 20 seconds. booting time 16.64s Application 3.97s on first load

In queries tab, it's 8ms

tisuchi's avatar

@Hirog 20s is huge. Is that running locally?

Can you check in the console & network what is taking such a big amount of time?

Hirog's avatar
Level 1

@tisuchi yes locally and yes huge !

this is the document that took 20 seconds (first line in Network)

Hirog's avatar
Level 1

I tried memcached and nothing changed

Hirog's avatar
Level 1

php artisan and composer are slow too (the first time use)

kokoshneta's avatar

@Hirog Then it’s not an issue with your server or site as such, but something more general on your machine. Hard to say what exactly.

1 like

Please or to participate in this conversation.