initial load after a period of no requests

I wanted to ask if you know if fly io after not receiving requests to a website, in this case my portfolio, when requested again, takes a little longer than normal to load, about 10 seconds until the website loads and finds it.

Do you know if it can be fixed or is there a better web display on another page that doesn’t do it?

Can it be fixed by buying a hostinger domain or something?

This is probably because you have the following in your fly.toml:

auto_start_machines = true
auto_stop_machines = true
min_machines_running = 0

This means if your app isn’t getting any traffic, all your Machines will be stopped. When your app next receives a request, one of the Machines will be started, but as you’ve observed, this is a cold start so it takes a few seconds (I think usually ~3 seconds) to respond to the request.

If you want to keep one Machine running at all times, you’d have to have min_machines_running = 1 and fly deploy to update your apps configuration. This is more costly though, because you have to pay to keep at least one Machine running, but it’s the only way to avoid cold starts.

Hi(jacking,)

Will an internal request, eg curl http://app.internal:3000 hit the fly proxy to trigger the auto start? It doesn’t look like it does… In another thread, I read creating an internal ipv6 will allow it to use the fly proxy internally? But when I curl against that the request connects but it drops and it doesn’t auto start the app, eg curl http://[ip-v6]:3000

I don’t believe it will. For that, I think Flycast will work.

1 Like

Thanks! This works perfectly.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.