Tue Apr 16 2019

What is Heroku and how does it work?

Technology990 views


Heroku is a cloud application development platform that provides development tools, scalable processing power and cloud management functionality for the development of Web applications and services. It's a container-based cloud Platform as a Service (PaaS).

Heroku was founded by James Lindenbaum, Adam Wiggins, and Orion Henry in 2007. The name “Heroku” was suggested from a portmanteau of the words “hero” and “haiku.” In 2010, Heroku was acquired by Salesforce.com. The company headquarters are situated in San Francisco.

Heroku was initially developed for Ruby on Rails, and now also support various other development languages such as Java, Node.js, Scala, Clojure, Python, PHP, and Go. It's composed of various components working together to provide a complete cloud development platform. It has various add-on services that enable developers to integrate third-party solutions for various services including database, monitoring, email, billing, and many others.

Features of Heroku

Heroku provides a very well written tutorial which allows you to start in minutes. Also, they provide first 750 computation hours free of charge which means you can have one processes (aka Dyno) at no cost. Also, performance is very good e.g. simple web application written in node.js that can handle around 60 - 70 requests per second.

  • Instant Deployment with Git push - build of your application is performed by Heroku using your build scripts

  • Plenty of Add-on resources (applications, databases, etc.)

  • Processes scaling - independent scaling for each component of your app without affecting functionality and performance

  • Isolation - each process (aka dyno) is completely isolated from each other

  • Full Logging and Visibility - easy access to all logging output from every component of your app and each process (dyno)

How does it work?

Heroku lets you deploy, run and manage applications written in Ruby, Node.js, Java, Python, Clojure, Scala, Go and PHP.


An application is a collection of source code written in one of these languages, perhaps a framework, and some dependency description that instructs a build system as to which additional dependencies are needed in order to build and run the application.

Dependency mechanisms varies across languages:.

  • In Ruby, you use a Gemfile.

  • In Python a requirements.txt.

  • In Node.js a package.json.

  • In Java a pom.xml and so on.


The source code for your application, together with the dependency file, should provide enough information for the Heroku platform to build your application, to produce something that can be executed.

On Heroku, there is no need to make any changes to an application in order to run it. If using some established framework, Heroku can organize it. Such as:

  • In Ruby on Rails, it’s typically rails server.

  • In Django it’s python <app>/manage.py runserver.

  • In Node.js it’s the main field in package.json.

And for other applications, may need to explicitly declare what can be executed.

This file declares a web process type and provides the command that needs to be executed in order to run it. In this case, java -jar lib/foobar.jar $PORT. It also declares a queue process type and its corresponding command.


Heroku is a polyglot platform. It lets you build, run and scale applications in a similar manner across all the languages – utilizing the dependencies and Procfile. The Procfile exposes an architectural aspect of your application (in the above example there are two entry points to the application) and this architecture lets you, for example, scale each part independently.


Deployment is about moving your application from your local system to Heroku - and Heroku provides several ways in which apps can be deployed.

Git is a powerful and distributed version control system that many developers use to manage and version source code. The Heroku also uses Git as the primary means for deploying applications.

When you create an application on Heroku, it associates a new Git remote, typically named Heroku, with the local Git repository for your application.

Build mechanism

When the Heroku platform receives the application source, it initiates a build of the source application. The build mechanism is typically language specific, but follows the same pattern, typically retrieving the specified dependencies, and creating any necessary assets.

The source code for your application, together with the fetched dependencies and output of the build phase such as generated assets or compiled code, as well as the language and framework, are assembled into a slug.


Heroku executes applications by running a command you specified in the Procfile, on a dyno that’s been preloaded with your prepared slug. Think of a running dyno as a lightweight, secure, virtualized Unix container that contains your application slug in its file system. You also have control over how many dynos are running at any given time. Scaling an application involves varying the number of dynos of each process type.


The combination of slug and configuration is called a release. Every time a new version of an application is deployed, a new slug is created and release is generated.

As Heroku contains a store of the previous releases of the application, it's designed to make it easier to roll back and deploy a previous release. A release, then, is the mechanism behind how Heroku lets the developer modify the configuration of the application (the config vars) independently of the application source (stored in the slug) - the release binds them together.

Logging and monitoring

Heroku treats logs as streams of time-stamped events, and collates the stream of logs produced from all of the processes running in all dynos, and the Heroku platform components, into the Logplex- a high-performance, real-time system for log delivery. Logplex keeps a limited buffer of log entries solely for performance reasons.


Although Heroku charges you by the dyno, they aren't actually hosting your app. In fact, the entire Heroku platform, as well as every app built on Heroku is deployed to Amazon Web Services (AWS).

We use cookies to improve your experience on our site and to show you personalised advertising. Please read our cookie policy and privacy policy.