#Calling healthcheck endpoint rarely takes >5 seconds to response. Normal?

4 messages · Page 1 of 1 (latest)

round veldt
#

I work on a large Laravel project, and I have a healthcheck endpoint that does not call the database (confirmed when I enabled profiling), and I have another service that periodically calls the healthcheck endpoint to check that my main Laravel project is up, and then records the time it takes for the healthcheck endpoint to response.

Normally it takes about 0.02 seconds for the endpoint to respond.

But rarely it randomly takes >5 seconds to respond, even though it's confirmed that there's barely any traffic to the site.

I can confirm that it's not the connection that takes long to establish, but waiting for the response to complete that takes long, because my other PHP monitoring application shows a curl "operation timed out" error (I have a 5 second limit set).

My primary question is is it somewhat normal for requests to take long to respond rarely i.e. am I being too strict with the 5 second limit, and should probably be a lot more generous with the limit?

Maybe there are DNS issues with some middleware involving I/O e.g. the Sentry or ElasticSearch logger.

jade cypress
#

Depends a lot on how it's hosted. For example on Laravel Cloud it could be hibernation, which takes a long time to wake up. On a shared host it could be because of the shared hosting nature. On a VPS it could be because of shared traffic / shared CPU. Even for PHP-FPM it could be that there are no processes, so it would need to spin up processes, which could take a bit

dire nymph
#

If parts of the infrastructure is hibernating (or using serverless), then it's normal. But if it's a continuously running server, I would not expect that long response times.

Is this completely random, or is it slower at times of lower usage? Could expired cache/opcache be part of the explanation? Do you notice the same slow response manually, or only reported by the health checker?

#

Are you using any Laravel packages? I have seen some Blade packages cause extreme response times in uncached state.