How to scale your application
Once you have deployed your app and are ready to launch you will probably want to disable auto-scaling to 0 and beed up your machine to handle more traffic.
You will likely see a warning on your fly dashboard stating - “Your app is currently running on a single machine To ensure high availability, especially for production apps, we’d strongly recommend running at least 2 machines”
As we are using sqlite there is no built in data replication so we have to use 1 machine!
We can however improve the single machine by bumping up the RAM or CPU count - note this will have affect on price.
By default your fly.toml
is set to shut down the machine after a period of inactvity.
This is useful during development but once you launch it much better to avoid the cold start time of starting up the machine when someone hits your url.
fly.toml
Update http_service to:
Fly will now keep your machine running until stopped. But will automatically restart the machine if it crashes for any reason.
You can safely change the ram or cpu count to a higher number to handle more traffic. (e.g during a launch week)
fly.toml
Update vm to :
LiteFs is a solution for Sqlite replication. I’m currently working on implementing this into the boring database repository so keep an eye out!