#First request slow if not hit for some time.

15 messages · Page 1 of 1 (latest)

abstract relic
#

This seems to be a trend on local WAMP server, homestead, artisan serve, docker and on Vapor.

The first request in a while on a laravel API application is slow, then subsequent requests seem to be faster, is there a reason for this?

Attached is an example of the same request made multiple times, the first is slow the remainder quick. To rule out database issues, I tried a hello world endpoint, to rule out cached responses I tried a random string generator so that the response remained dynamic.

All experiments lead to the same result, the first request is slow, the remainder are fast.

Any thoughts or ideas are welcome.

left prawn
abstract relic
#

I use warming on Vapor to keep it warm, but still get the issue, its really odd.

left prawn
#

if you run nginx or apache it should not act like this

abstract relic
#

im using apache at the moment locally and it does it

left prawn
#

Oh, the other reason may be if you have some caching or events / cron jobs which are executed when you hit app. But then vapor should trigger it. What time gap for this behavior? How long app should be inactive?

abstract relic
#

i will run further tests to establish timings

abstract relic
#

Seems about 2 minutes it takes to go cold

#

after which point the next request becomes 3x as slow

left prawn
abstract relic
#

any idea what the cause is?

#

I'm suffering the issue on Vapor too, even though I';m using warmers

left prawn
# abstract relic any idea what the cause is?

I think I don't have enough experience. But I would suggest you to download latest version of laravel with sail and try to run clean app. If there will no be longer reqeusts then the problem can be in your code, not server. It might help to make list of possible problems make shorter.