VM first visit delay

I’m about to migrate my first app from development to production and I’m trying to understand better it’s performance.

I noticed that whenever I access my website (that still has no visitors) it has a delay of 3 to 5 sec on the first visit, I’m considering that’s the VM time to wake up. I tried to avoid this scaling my app to 2x shared CPU, to no avail. Scaled Postgres machine too, same thing.

How do I avoid this first time visit delays? Need to scale more?

Try setting min_machines_running = 1. See Setting a minimum number of instances to keep running when using auto start/stop for details.

Hi @rubys, thanks for your input.

I tried to put in my fly.toml

auto_start_machines = true
auto_stop_machines = true
min_machines_running = 1

To no avail. After some minutes if I visit my website it takes 5 seconds or more to wake up, then it start to respond quickly.

Any other sugestion?

By any chance are you running an old version of flyctl?

Hi @rubys. No, its 0.1.3

My mistake on this one, I made a deploy in a different country than I was testing, so for sure a 3 to 5 seconds delay was expected. When I tested from the country in question went below 500ms.

1 Like

Edit: I see our posts overlapped :laughing:

Hi @TaskS

Maybe the delay has something to do with the database connection, if the site needs to connect on the first visit?

It might be helpful to look at the logs for your postgres app (is it Fly Postgres?), and for the app connecting to it, when this delay happens.

Hi @andie I was looking for this just before I realize that was just a geografical issue :roll_eyes:

Thanks for your input

Glad to hear that you figured it out! :slight_smile:

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