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

Timing out long requests with Unicorn


A web application's throughput is dependent on the number of concurrent requests it can serve as well as how quickly it can serve each of these requests. An application will be able to handle most web requests very quickly and move on to serving the next request. However, what happens if a single request takes 10, 20, or even 30 seconds to complete? The Unicorn worker processing that request will be unable to take on another one until its current long-running request is complete. Under normal traffic, this would probably be fine. Another Unicorn worker will pick up the incoming requests, but it becomes a problem when an application needs to be processing a high number of requests very quickly.

In this recipe, we will learn how to timeout long-running requests to keep them from tying up resources and hurting our application's throughput.

How to do it…

To get started, let's open up a terminal and navigate to our Rails application that runs Unicorn by performing...