December 09 2022 12:51 pm

CPU Autoscaling on Heroku with 123 Dyno


123 Dyno extends Heroku with the ability to autoscale via CPU load by simply installing the add-on and configuring. While controllable response time autoscaling is useful for a large number of applications especially older concurrent frameworks, CPU autoscaling ensures that you get the most out of the dynos you're paying for. This can drastically reduce your bill by only paying for compute power you use versus the response time your app returns in stock autoscaling. This is particularly true of event loop paradigms like Node.js and Tornado where the application can handle incredible amounts of requests on little compute power, response times usually bottlenecked elsewhere.

The Node.js powered Strapi Headless CMS server this blog is running on can handle conservatively 800 req/s before starting to autoscale and max out CPU on a shared Standard-1x Dyno, better performance on dedicated Performance Dynos. All languages/frameworks can benefit from CPU autoscaling however as a way of autoscaling via compute power independently from response times which are dependent on many different factors.

Below is a Apache Benchmark test of Strapi at ~290 req/second on a single Standard-1x Dyno at 1000 concurrency along with the analytics dashboard of 123 Dyno below.

At first glance it might seem like response times increased drastically but actually that spike is due to file uploads using Strapi normally. Notice the /upload path in Max Response Times. In stock autoscaling this can trigger upscaling when its not necessary and throw off your daily M95 sample value, increasing your bill with enough common file uploads.

More important to note here is that reponse time is not related to used compute power. The lower left box is CPU utillization which is close to zero most of the time, peaks in autoscaling are from Apache Benchmark tests only.

Autoscaling via response time here would not only increase your bill but it would not make full use of the dyno compute power paid for. You can save incredible amounts of money by autoscaling by CPU instead of response times for a large number of compute scalable applications.

If you have a non-compute bound application and want to autoscale by response times, 123 Dyno has an improved response time autoscaling solution too.

123 Dyno provides the tools to take Heroku further, cut your dyno bill and autoscale efficiently, keeping you on Heroku because of the ease of use, expansive ecosystem and complete infrastructure management. Use the savings for features like Heroku's managed private spaces or other add-ons that can save you crucial development time on the platform.

Bonus: The Strapi instance used in this example can be installed via this button click.

Read More About 123 Dyno

The 123 Dyno 12x speed increase to Heroku.

Drastically Improved Response Time Autoscaling.