Skip to main content

Scale Your App

Learning Objectives

After completing this unit, you’ll be able to:

  • Monitor app performance.
  • Choose the correct dyno for an app.
  • Scale dynos horizontally and vertically to meet evolving demands.

Monitor Performance

The Ursa Major Marketing team is happy to see more prospective customers requesting quotes. However, they notify Wei that they’re hearing complaints about the site being sluggish or unresponsive.

Wei knows that the Heroku Dashboard provides her with a clear picture of the volume of traffic and overall app health and performance.

She opens the app’s Metrics tab and looks at the past 7 days, which is the maximum option.

The first metric she checks is the throughput. It indicates the number of requests the server receives in relation to time. She confirms an uptick in traffic and sees a high number of failed requests. They all share the same error code: 408 - Request Timeout. This error indicates that the server may be overloaded.

Throughput metrics chart in the Heroku Dashboard.

To understand the root cause, she looks at the Response Time metric and sees that it increased dramatically. She knows it’s because Marketing asked her to add features to the quote, making the PDF-rendering process a lot slower.

Response Time metrics chart in the Heroku Dashboard.

Scale the App

Wei can’t just immediately change the code to fix these performance issues, so as a short-term fix, she scales up her infrastructure.

There are three ways to achieve this.

  • Horizontal Scaling: Increase the number of web dynos to serve more requests.
  • Vertical Scaling: Switch to a more performant dyno type, with more memory and more CPU.
  • Vertical and Horizontal Scaling: Switch to more performant dynos and increase their number.

A dyno is a containerized Linux virtual machine, managed by Heroku. Applications run on dynos. The dynos come in different tiers: Eco, Basic, Standard, and Performance. These tiers determine the resources allocated to your dynos and affect factors such as performance, scalability, and pricing.

The Eco and Basic tiers are designed for small applications. An application running on either tier can only run a single dyno per process type—for example, one web dyno and one worker dyno.

Because the lower tiers can only run one web dyno, Wei’s only option is to scale up her Basic dyno to a Standard-1X dyno, before scaling to three dynos. Her app’s performance improves significantly after scaling.

To get ahead of any future performance issues, she goes back to the Metrics tab and sets alerts on the Throughput and Response Time metrics. This way, she gets notified as soon as problems start occurring again and can react immediately.

While Wei addressed the app’s immediate performance issues, she must rethink her app’s architecture to address the slow response times.

Resources

Keep learning for
free!
Sign up for an account to continue.
What’s in it for you?
  • Get personalized recommendations for your career goals
  • Practice your skills with hands-on challenges and quizzes
  • Track and share your progress with employers
  • Connect to mentorship and career opportunities