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

Analyzing Heroku Postgres's performance


Database performance is critical to have a highly responsive web application. Heroku gives us a handful of tools to analyze our Postgres database for performance issues. Knowledge is power, and having visibility into emerging issues can help us fix them before they turn into major problems. In this recipe, you will learn about your cache hit rate, slow queries, and unused indexes.

Getting ready

In this recipe, we will be making use of the pg-extras plugin for Heroku. It gives us access to additional commands to administer our Postgres database.

To install it, you need to open a terminal and run the following command:

$ heroku plugins:install git://github.com/heroku/heroku-pg-extras.git

How to do it…

We'll be using the Heroku CLI to monitor the performance of our database.

  1. To get an overview of our database's general health, we can run the pg:diagnose command:

    $ heroku pg:diagnose
    GREEN: Connection Count
    GREEN: Long Queries
    GREEN: Idle in Transaction
    GREEN...