Book Image

Heroku Cookbook

By : Mike Coutermarsh
Book Image

Heroku Cookbook

By: Mike Coutermarsh

Overview of this book

Heroku is a Platform as a Service that enables developers to rapidly deploy and scale their web applications. Heroku is designed for developer happiness, freeing developers from doing system administrative tasks such as configuring servers and setting up load balancers. Developers are able to focus on what they do best, building web applications, while leaving the details of deployment and scaling to the experts at Heroku. This practical guide is packed with step-by-step solutions to problems faced by every production-level web application hosted on Heroku. You'll quickly get comfortable with managing your Heroku applications from the command line and then learn everything you need to know to deploy and administer production-level web applications.
Table of Contents (17 chapters)
Heroku Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Monitoring and tuning Unicorn's memory usage


Our main constraint when running multiple Unicorn workers is the memory available on the dyno. A typical application will use somewhere between 50 and 200 MB of memory per process. We want to configure our application to use between 50 to 70 percent of the available memory on a dyno. This gives our processes room to grow while still using most of the resources we are paying for.

In this recipe, we will be learning how to determine how much memory our application uses per Unicorn process. We will then be tweaking our configuration to maximize concurrency within a single dyno.

Note

We want to avoid running too close to 100 percent memory usage. If we run out of memory, our dyno will start using swap. This should be avoided at all costs. Using any swap will greatly decrease the performance of the dyno and response times will skyrocket.

How to do it…

To get started, let's open up a terminal and navigate to the directory with our Unicorn application using...