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 load average and memory usage


We can monitor the resource usage of our dynos from the command line using the log-runtime-metrics plugin. This will give us visibility into the CPU and memory usage of our dynos. With this data, we'll be able to determine if our dynos are correctly sized, detect problems earlier, and determine whether we need to scale our application.

How to do it…

Let's open up a terminal; we'll be completing this recipe with the CLI by performing the following steps:

  1. First, we'll need to install the log-runtime-metrics plugin via the CLI. We can do this easily through heroku labs:

    $ heroku labs:enable log-runtime-metrics
    
  2. Now that the runtime metrics plugin is installed, we'll need to restart our dynos for it to take effect:

    $ heroku restart
    
  3. Now that the plugin is installed and running, our dynos' resource usage will be printed to our logs. Let's view them now:

    $ heroku logs
    heroku[web.1]: source=web.1 dyno=heroku.21 sample#load_avg_1m=0.00 sample#load_avg_5m=0.00...