Diana E.
Diana E.

Reputation: 319

Does Increased Dyno Count === Increased Performance ? Will it make my app accommodate more traffic?

I've got a Rails app deployed on Heroku. It's getting a ton of traffic and it's lagging as a result. I'd like to: 1) make the app run faster and 2) make it so that the app can accommodate heavy traffic on any given day. I read about Heroku's "dynos" feature and have a few questions. Here's the Heroku explainer on what dynos are:

Heroku docs:

The containers used at Heroku are called “dynos.” Dynos are isolated, virtualized Linux containers that are designed to execute code based on a user-specified command. Your app can scale to any specified number of dynos based on its resource demands. Heroku’s container management capabilities provide you with an easy way to scale and manage the number, size, and type of dynos your app may need at any given time.

My questions:

  1. Increasing my app's dynos count means that I'm increasing the number of containers that will execute its code -- correct?
  2. Will increasing my app's dynos count make the app run faster? And so, the more dynos (containers) my app has, the greater the app will be able to withstand increased traffic? Is that the correct way to think of it? Increased dynos === increased performance ?
  3. I currently have 1 dyno and my app runs slow whenever it's hit w/ a lot of traffic. What factors should I consider when determining the optimal dyno count for my app? I can imagine the size of my app is one of those factors -- if so, where can I check to see how big my app is?
  4. Besides possibly increasing my app's dynos count, how else can I ramp up performance, with regarding to making my app being able to withstand increased traffic and not lag?
  5. Are there any negative side effects to increasing the dynos count?

Thank you in advance for your help with this! I'm a software developer and I can deploy an app to a virtual platform to get it in production -- but I don't know much about dev ops. Halp!

Upvotes: 0

Views: 994

Answers (1)

John Beynon
John Beynon

Reputation: 37507

First up, increasing dyno count will not make your application run faster. It will however let you handle more requests at the same time, which may give the perception of speeding up your application. As requests come in your application has to execute your code and return a response. If your application is executing code already then other requests may need to wait to execute - thus exhibiting a 'slow response'. As it's a Rails app, you really want to ensure you are using Puma as your webserver and that you have to be configured it to use multiple processes (the number of which is specific to your application - there are guides available for this).

It's really important to make your application as fast as possible, caching etc all helps with that to keep things running sweet. Also, there's no magic number for the number of dynos to run - it's down to your traffic patterns. More requests per second == more dynos.

You do have the option of scaling vertically, this gives you more CPU and more RAM but with added cost.

Also, there's no real downside of scaling up except the added cost. Often though, I've seen that scaling up is often unnecessary. It solves an immediate problem but with the added cost. Often, optimising code, queries, caching etc is a much better path. Using NewRelic here really helps as that shows you were the time is spent inside your application. You'd be amazed at the performance a single Dyno can give you!

Upvotes: 2

Related Questions