background preloader


Facebook Twitter

2. How Heroku Works - Heroku: Up and Running. At the time of writing, Heroku has had over three million separate applications deployed on its infrastructure, and this number grows day by day.

2. How Heroku Works - Heroku: Up and Running

Running a large number of applications day to day requires a substantially different approach than running just a handful, and this is one of the reasons that the Heroku architecture is markedly different from what you or I might develop if we were setting up our own environment on our own hardware for a single application. Heroku’s task is to support the running of all of these applications at the same time, managing the deployments that users are requesting, as well as scaling applications’ needs. In order to achieve this, the Heroku platform is broken up into several key segments; the most important among these are: In addition to these, there are a number of extra components, such as the Logplex and the various add-ons and services available to your applications (see Figure 2-1).

So, let’s walk through all of these parts in turn. Figure 2-2. HTTP Routing. Last updated 10 November 2015 The Heroku platform automatically routes HTTP requests sent to your app’s hostname(s) to your web dynos.

HTTP Routing

The entry point for all applications on the Cedar stack is the domain which offers a direct routing path to your web dynos. This article provides a detailed reference of how the router behaves, and how it conforms to the HTTP specification. Routing Inbound requests are received by a load balancer that offers SSL termination. The routers are responsible for determining the location of your application’s web dynos and forwarding the HTTP request to one of these dynos. A request’s unobfuscated path from the end-client through the Heroku infrastructure to your application allows for full support of HTTP 1.1 features such as chunked responses, long polling, websockets, and using an async webserver to handle multiple responses from a single web process.

Request distribution Request queueing Each router maintains an internal per-app request counter. Warming Up a Java Process. Last updated 04 November 2015 The first request made to a Java or JVM web application is often substantially slower than the average response time over the life of the process.

Warming Up a Java Process

This warm-up period can usually be attributed to lazy class loading and just-in-time compilation, which optimize the runtime for subsequent requests that execute identical code. As a result, many users find it beneficial to submit a few artificial requests into the JVM process before using it to handle real traffic. Development and Configuration Principles. Last updated 13 October 2015 Using Heroku as your deployment environment not only impacts the runtime aspects of your application, but also its development process.

Development and Configuration Principles

Included here are several principles of application development and configuration central to the development experience on Heroku. These development and configuration principles are one of several categories of best-practices when developing for Heroku. Please review all the principles of architecting applications to gain a complete understanding of properly developing apps on Heroku. Applications & codebases When developing an app most of the work is done on the application’s codebase which is stored in some form of version control system (VCS) like Git, Subversion, Mercurial etc… The VCS keeps track of the many revisions of the codebase and coordinates the modifications to the source code amongst development teams of all sizes.

On deployment to Heroku your app will be transmitted via the Git VCS. Dependencies Configuration. Managing Multiple Environments for an App. Last updated 06 January 2017 Every Heroku app runs in at least two environments: on the Heroku platform (we’ll call that production) and on your local machine (development).

Managing Multiple Environments for an App

If more than one person is working on the app, then you’ve got multiple development environments - one per machine, usually. Usually, each developer will also have a test environment for running tests. This separation keeps changes from breaking things. You write code and check the site in development, but you run your tests in the test environment to keep them from overwriting your development database. Unfortunately, this approach breaks down as the environments become less similar. Heroku Postgres. Last updated 30 October 2015 Heroku Postgres is the SQL database service run by Heroku that is provisioned and managed as an add-on.

Heroku Postgres

Heroku Postgres is accessible from any language with a PostgreSQL driver including all languages and frameworks supported by Heroku: Java, Ruby, Python, Scala, Play, Node.js, PHP, Go, and Clojure.


AddOn. 1. Getting Started with Heroku - Heroku: Up and Running. Chapter 1.

1. Getting Started with Heroku - Heroku: Up and Running

Getting Started with Heroku All day, every day, the Internet gets larger and larger, and recent estimates show simply phenomenal growth. Every minute, the Web is growing at a rate of over 500 new sites, while popular video hosting service YouTube is said to be receiving over 48 hours of new video content. Twitter users create over 100,000 new tweets, while Facebook users share over 600,000 new posts. To the common observer, these numbers are amazing. The Dawn of Virtual Servers No more than 10 years ago, the way a developer such as yourself would bring a new website or application onto the Web was to go out and purchase a new server, configure it, and find a data center that would host the server in a rack for you.

Now fast-forward a few years. As a physical server is able to contain multiple virtual servers, an industry sprung up where companies would create data centers filled with machines that were sliced up and rented out to developers to use for their applications. Logs.