This repo contains code to demonstrate an issue where a healthcheck returns slowly because of code in other places taking a long time.
slow.php connects via curl to a local HTTP server and makes a request that intentionally doesn't return for 5s.
The load
service in the Dockerfile
generates a load on the slow.php file.
Eventually the load created overwhelms the PHP-FPM workers and subsequent requests to the healthcheck at health.php
fail to respond within the 3 second timeframe of the reverse proxy.
docker-compose up
New tab/window:
time docker-compose run --rm healthcheck
Should see healthcheck return "ok" < 1s
Generate fake load:
docker-compose run --rm -d load
time docker-compose run --rm healthcheck
Should see healthcheck return > 3s