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

Using a follower for read-only DB queries


As an application grows, the database is typically one of the largest performance bottlenecks. The first step in horizontally scaling a database is to enable replication to a follower database. When we enable a Postgres follower, all writes to the master database are streamed to the follower. This gives us a read-only replica of all our data. We can then reduce the load on our primary database by directing read-only queries to a follower database. This frees up resources on our master database to handle writes.

Note

Replication lag is the delay between the write to the primary database and this data's availability on the follower. We need to be aware that there might occasionally be a second delay before the data is on the follower.

Getting ready

First, we'll need to set up a follower database on Heroku. For instructions on how to do this, refer to the Creating a read-only follower recipe in Chapter 9, Using and Administrating Heroku Postgres.

Note

Follower...