A dyno, the unit of computing power on Heroku, is a lightweight container running a single user-specified command. Today we’re announcing a dyno with twice the capacity: 2X dynos.
Existing dynos are now called 1X dynos. They come with 512MB of memory and 1x CPU share. They cost $0.05/hr. 2X dynos are exactly what their name implies: 1GB of memory and twice the CPU share for $0.10/hr. To support the growth of current and future apps on the platform, you can now control your dyno resources on two axes: size and quantity.
Let’s try them out.
Using the Heroku Toolbelt, resize your dynos with the
$ heroku ps:resize web=2X worker=1X Resizing dynos and restarting specified processes... done web dynos now 2X ($0.10/dyno-hour) worker dynos now 1X ($0.05/dyno-hour)
To view the dyno size of a process type, use the ps command:
$ heroku ps === web (2X): `bundle exec unicorn -p $PORT -c ./config/unicorn.rb` web.1: up 2013/03/27 14:27:58 (~ 6h ago) web.2: up 2013/03/27 14:47:04 (~ 6h ago) web.3: up 2013/03/27 15:08:23 (~ 5h ago) === worker (1X): `bundle exec rake worker:job` worker.1: up 2013/03/27 14:39:04 (~ 6h ago) worker.2: up 2013/03/27 15:08:24 (~ 5h ago) worker.3: up 2013/03/27 14:30:55 (~ 6h ago)
Using the Dashboard use the app’s resources page:
For full instructions, see the Dev Center article.
You can already scale horizontally, adding more dynos with
heroku ps:scale. When you want to scale vertically instead, use larger dynos with
1. Concurrency for Rails with Unicorn - The first use case is increasing concurrency on single-threaded Rails apps using Unicorn. Due to the improved in-dyno queuing efficiency that results from increasing the number of Unicorn workers, doubling the workers in 2X dynos while halving the dyno count often results in better performance.
2. JVM Languages - The modern JVM has an explicit memory model designed for multi-threaded concurrency, and has many frameworks explicitly designed to take advantage of this property. Utilizing more threads requires more memory for both the thread stacks and for objects created by these threads. The JVM is fully capable of taking advantage of the vertical scale in a 2X dyno.
3. Memory-intensive background jobs - image processing and geospatial processing often need larger dynos. If you’ve gotten an R14 out-of-memory error and this is not a leak, 2X dynos might be for you.
2X dynos give you a new knob to turn: vertical scale. Vertical scaling is appealing when the consolidation of compute power and memory increases overall performance. This can translate into better app performance at the same cost, and possibly lower costs if the set of dynos can be reduced by more than half.
It's impossible to make blanket statements about app performance due to each app's unique performance characteristics. I/O-bound apps may not benefit from an increase in memory and compute, while process-heavy apps would. The best way to determine in what configuration your app runs best is to measure it. Heroku provides several tools to help you understand your application's behavior.
Use log2viz to understand how much memory and CPU is being consumed by your current app/dyno configuration. If the memory usage or web dyno activity indicators are close to their limits, 2X dynos may provide much-needed increase in resources. The latest New Relic add-on accurately displays request queue times and can be used to visualize the impact a higher-concurrency configuration has on your app. Use 2X dynos to double your in-dyno Unicorn workers and mitigate inconsistent and variable queue times.
Through the duration of the beta period, 2X dynos will cost the same as 1X dynos, that is $0.05 per hour. Once generally available they will cost $0.10 per hour.
If you’re looking to improve concurrency on Rails apps, making use of JVMs or other memory-hungry tasks, 2X dynos have a lot of potential to make apps faster. Give them a try.
How can I measure how much memory my dynos are using?
log-runtime-metrics Labs feature provides logged metrics that can be consumed and inspected with an add-on that consumes logs such as Papertrail, or displayed by a visualization tool like log2viz.
How do 2X dynos affect the 750 free dyno hours?
2X dynos consume twice as many free dyno-hours per hour as 1X dynos. Example: A 2X one dyno app will run for free for 375 hours compared to 750 hours for a 1X one dyno app.
Do single 2X dyno apps idle?
Yes. Idling affects single 1X and 2X dyno apps alike.
Can dyno size be configured on a per process-type basis?
Yes. Dyno size can be applied on a per process-type basis. For example:
heroku ps:resize web=2X worker=1X worker2=2X
Can I get 4X (or larger) dynos?
We are exploring the option. If you have an app that may need these, send us a note.