Three ways to scale up your apps with Render

When your app is experiencing high traffic or usage, you need to scale your service to handle that load.

Scaling can be done either vertically or horizontally – or both! Vertical scaling means making a single resource bigger or more powerful. For example, you can add more CPU or RAM to your server. Horizontal scaling means creating multiple instances of the same service. For example, you can deploy three copies of your servers instead of one and then put them all behind a load balancer that does the work of routing traffic to each of them. Both types of scaling can be done manually or automatically (autoscaling).

Often, companies don’t host their apps on-premises on their own servers, instead hosting them in the cloud. Render is an integrated, full-stack development platform that makes it easy to host your apps, be they static sites, web services, or cron jobs. And, scaling is a breeze with Render. In this article, we’ll explore three ways to scale your apps with Render.

Option #1: Using the Render Dashboard

The first option is to scale your service using the render dashboard. Once you have created a web service, you can navigate to scaling tab to configure your scaling settings.

When auto-scaling is off, you can manually scale your app up or down in the UI by specifying the number of instances. For example, you might usually only need one instance of your service, but this week you’re expecting an increase in traffic due to an upcoming event. You can choose to increase your service to three instances to handle that increased load. When the event is over, you can extend your service back to an instance.


manual scaling option

Manual scaling works well if you can anticipate changes in load, but you can’t always be right about how many instances you need. Estimating too much or too little can leave your service under or over-use, neither of which is ideal.

Autoscaling takes the guesswork out of automatically scaling within a range of minimum and maximum instances based on CPU and/or memory usage.

In the render dashboard, you can enable auto scaling using the toggle switch. You can then set min and max instances with your goals for CPU and/or memory usage. Then, depending on those goals, your app will automatically scale up or down as needed. how good is!

auto scaling option
auto scaling option

Option #2: Using the Render API

Another option to enhance your service is to use the Render API. Once you have generated the API token in your account settings, you can start using the Render API to make requests.

API endpoint for scaling
API endpoint for scaling

An API endpoint allows you to scale your service to a specified number of instances. All you have to do is make a POST request to the endpoint providing your API token serviceID And numInstances Parameters like:

curl --request POST \
 --url https://api.render.com/v1/services/{serviceId}/scale \
 --header 'accept: application/json' \
 --header 'authorization: Bearer {API_Token}' \
 --header 'content-type: application/json' \
 --data '{"numInstances":2}'

Making an API request manually is obviously a manual scaling process, but the API has to be used programmatically. If you have some additional monitoring or alerts set up, you can programmatically call this API endpoint to scale your app up or down as needed, without any human intervention. However, this may be overkill, as Render already has the monitoring and autoscaling infrastructure to do this for you.

Option #3: Using the Blueprint Specification

The third option we will consider is to use a blueprint specification to enhance your service. Blueprint specs are infrastructure as code (IaC) that is written using YAML files that contain key-value pairs for configuration. The main advantage of IaC is that it allows you to create and manage services through code, rather than a dashboard. This way, you can keep your configuration under source control, standardize your setup, and easily implement changes to the new infrastructure.

Render’s blueprint specs provide two options for scaling your app. If you don’t want to use autoscaling, you can specify a numInstances A number for the key and value like this:

numInstances: 3

If you want to take advantage of auto-scaling in your service, you can configure scaling Property like this:

scaling:
  minInstances: 1
  maxInstances: 3
  targetMemoryPercent: 60
  targetCPUPercent: 60

These are the same options you see in the render dashboard, but now instead of setting them manually in the UI, you’re writing your infrastructure as code. clean!

conclusion

It’s easy to scale your app with Render. Whether you prefer to scale your app in the render dashboard, through the API, or via the Blueprint spec, Render has you covered.

Thanks for reading, and happy coding!

Leave a Comment