Deploying an app is just the start. We need to scale our app as our user base grows. It could be a linear growth or random spikes in certain times.
Either way, we need to make sure our app is running smoothly as the traffic increases. All the Now deployments are backed by "auto scaling ready" infrastructure. So, you are in good hands.
Each of your Now deployment consists of zero or few instances. An instance is a running version of your deployment. Now can clone and run new instances as needed and kill them if they are not needed.
Each deployment has a minimum and maximum amount of instances it can have. Based on that we can scale our app as needed.
By default, all of the deployments are configured like this:
This means, when your deployment receives some traffic Now will start an instance. If your deployment doesn't receive any traffic for a while, Now will kill that instance.
There's a fixed number of concurrent instances you can have based on the plan you've chosen. But with this configuration, you can have as many as deployments you want.
Having older deployments which are not active will cost you nothing.
As your user base grows, your app could be slower to respond. Because it tries to serve more requests than it could do.
To resolve this issue, you can scale your app to run a fixed number of instances and they'll run forever.
Here's how you can do that:
In this case, Now will set the
max instance settings to 3.
hello-node-lwbxweoqjo.now.sh is one of our deployment URL. Instead, you can scale a "domain name" you mapped with
For an example:
Then it'll scale the deployment behind the alias. (in this case, the alias is
If you run
now alias again, it'll scale the new deployment accordingly and scale down the old deployment to the default scaling setup.
Sometimes, your app may receive sudden traffic spikes and it's pretty hard to predict the pattern. Then you need to scale your app based on the traffic. To do that, you can turn on “auto scaling” by using different
max instance values.
You need to have the "Pro" plan or a higher plan to do "auto scaling"
Here's how to auto scale an app with the URL
Now the deployment behind
hnode.now.sh runs with a minimum of 2 instances and it can scale up to 15 instances as the traffic increases.
Now will automatically start and kill instances based on the traffic
All the static deployments are infinitely scalable and they are auto scaled by default on all plans.
So, you don't need to invoke
now scale for static deployments.