now has been designed from the ground up with dynamic scalability in mind. Today, I’m excited to introduce you to our now scale command, which gives you fine-grained control over our scaling and autoscaling capabilities.

Minimums and Maximums

Whenever we notice traffic has stopped flowing to your deployments for some time, we automatically freeze them. It typically freezes completely in under one hour.

This allows you to go back in time and access every single deployment you’ve ever made. No need to ever remove or overwrite a deployment. It facilitates teams to collaborate on development, staging and even rollbacks.

With our new pricing, we allow you to deploy infinitely (even in the OSS free plan!) and we only impose a limit on how many concurrent deployment instances you are running. Note that static deployments never sleep, are automatically scaled and are free on all plans!

It’s then useful to think of a deployment as being backed by zero or more instances by default. With now scale, you can now completely customize it!

First, we wanted to make auto-scaling as easy as one command. If you run…

now scale my-deployment.now.sh

…we’ll automatically set the minimum to 1 and the maximum near your plan’s cap. If you’re on the premium plan, for example, you’ll see something like this as the output of that command:

> Success! Configured scaling rules [1s]

my-deployment.now.sh (0 current)
   min 1
   max 10
  auto 

Notice that when both a min and a max are set, autoscaling is enabled. As traffic in your application grows, we’ll automatically increase your number of instances. If traffic goes down, we’ll decrease them.

You can also set up an exact number of copies at any given time:

now scale my-deployment.now.sh 1

That will set up both the minimum and maximum to 1.

If you want us to automatically determine the max and enable autoscaling, you can run:

now scale my-deployment.now.sh 1 auto

In summary, what you get is a completely universal deployment platform for every technology and programming language, all in one!


Deployment Instance URLs

One of the core design decisions of now is complete addressability of your cloud. Every service gets its own unique URL at every point in time.

Deployment instances are no exception. When you scale, you’ll see a list of URLs corresponding to each unique copy of your application:

 > Success! Configured scaling rules [2s]

 next-news-ocpilzfeof.now.sh (1 current)
    min 5
    max 5
   auto 

 > Scaled to 5 instances: [13s]
 - next-news-ocpilzfeof-9dd903688bb39fec49471710.now.sh
 - next-news-ocpilzfeof-9845234bec640d1751d2fb29.now.sh
 - next-news-ocpilzfeof-540137759b86e3d4ace7c60a.now.sh
 - next-news-ocpilzfeof-a1672e1853f224ba445c3547.now.sh
 - next-news-ocpilzfeof-97268249ee32cea712cca08f.now.sh

This level of granularity has great benefits when it comes to analyzing issues that could arise with a particular process. For example, you can try to curl an instance directly to start debugging it.


Production Scale

After you run now, your new deployment has only one backing instance. Once you assert your deployment works as intended, the next step is typically to upgrade it to production via now alias:

now alias my-deployment.now.sh my-app.com

We’ve added a new important enhancement to aliasing. If the alias alredy exists, your new deployment’s scaling rules are automatically adjusted to match the target.

> Alias my-app.com points to my-deployment-kxpjsscafe.now.sh (2 instances)
> Scaling my-deployment-zjwfktqlhq.now.sh to 2 instances atomically
> Scaled to 2 instances: [5s]
- my-deployment-zjwfktqlhq-1bfea9156b7a6d37eea7b22e.now.sh
- my-deployment-zjwfktqlhq-4e45d449f57580be4d7e3551.now.sh
> Success! next-news.now.sh now points to next-news-zjwfktqlhq.now.sh! [623ms]
> Scaled my-deployment-kxpjsscafe.now.sh down to 1 instance [977ms]

After matching the new deployment's scale to match the target, the alias is updated and finally the previous deployment downscaled!

This means you can execute now alias with full confidence that no requests will be dropped, but also that quality of service won’t be negatively impacted.


Conclusions

The `now scale` command is already available on the latest version of the Now CLI. You can start (auto)scaling your deployments today!

To learn about all its possible options, please run now scale -h.

The following events should also start reflecting on your web dashboards:

  • Scaling rule configurations
  • Autoscaling events (how many instances are added or removed)
  • Freezing and unfreezing

We are really thrilled to offer this new level of control and introspection, while preserving the simplicity and automation that you have come to expect from Now.

Have any questions? Come and chat with us!