I’ve noticed that it takes a while for my app to load. is there any reason why this happens? and is there a way to avoid this?
what do the logs of the machine and your app say?
i think it’s the health checks…although i’m not sure what i’m supposed to do.
2025-02-03T21:29:02Z health[683d524b454438] fra [error]Health check on port 3000 has failed. Your app is not responding properly. Services exposed on ports [80, 443] will have intermittent failures until the health check passes.
2025-02-03T21:31:51Z runner[784e19db332218] fra [info]Pulling container image registry.fly.io/xyz:deployment-01JK6VJCRYQN780BE85SEWETG2
2025-02-03T21:32:43Z app[683d524b454438] fra [info]I, [2025-02-03T21:32:43.036683 #627] INFO -- : [ad41f6ab-0c8f-4e6f-9c26-a5355ecc5a10] Started GET "/up" for 172.19.2.169 at 2025-02-03 21:32:43 +0000
2025-02-03T21:32:43Z app[683d524b454438] fra [info]I, [2025-02-03T21:32:43.037771 #627] INFO -- : [ad41f6ab-0c8f-4e6f-9c26-a5355ecc5a10] Processing by Rails::HealthController#show as HTML
2025-02-03T21:32:43Z app[683d524b454438] fra [info]I, [2025-02-03T21:32:43.038776 #627] INFO -- : [ad41f6ab-0c8f-4e6f-9c26-a5355ecc5a10] Completed 200 OK in 1ms (Views: 0.5ms | ActiveRecord: 0.0ms (0 queries, 0 cached) | GC: 0.0ms)
2025-02-03T21:32:43Z health[683d524b454438] fra [info]Health check on port 3000 is now passing.
2025-02-03T21:32:49Z proxy[683d524b454438] fra [error][PR04] could not find a good candidate within 21 attempts at load balancing
2025-02-03T21:32:49Z proxy[683d524b454438] fra [error][PR03] could not find a good candidate within 21 attempts at load balancing. last error: [PR01] no known healthy instances found for route tcp/443. (hint: is your app shut down? is there an ongoing deployment with a volume or are you using the 'immediate' strategy? have your app's instances all reached their hard limit?)
2025-02-03T21:32:49Z proxy[683d524b454438] fra [error][PR03] could not find a good candidate within 21 attempts at load balancing. last error: [PR01] no known healthy instances found for route tcp/443. (hint: is your app shut down? is there an ongoing deployment with a volume or are you using the 'immediate' strategy? have your app's instances all reached their hard limit?)
There are more logs before this point, but lets start with these three lines.
Ignore the line in the middle - it is for another machine ([784e19db332218]
).
The first line is printed after health checks timed out. The third line is printed when your server is starting to process requests, a full 3 minute and 41 seconds later.
When I run a tpyical Rails application on our smallest machines (shared-1), I see a 3 to 5 second delay. I don’t know what may be included in your startup code (typically found in config/initializers
) that is adding 3.5+ minutes to this. It may be that you need to optimize your startup somehow; either that or configure a larger machine.