Deep-dive on the Next Gen Platform. Join the Webinar!

Skip Navigation
Show nav
Dev Center
  • Get Started
  • Documentation
  • Changelog
  • Search
  • Get Started
    • Node.js
    • Ruby on Rails
    • Ruby
    • Python
    • Java
    • PHP
    • Go
    • Scala
    • Clojure
    • .NET
  • Documentation
  • Changelog
  • More
    Additional Resources
    • Home
    • Elements
    • Products
    • Pricing
    • Careers
    • Help
    • Status
    • Events
    • Podcasts
    • Compliance Center
    Heroku Blog

    Heroku Blog

    Find out what's new with Heroku on our blog.

    Visit Blog
  • Log inorSign up
Hide categories

Categories

  • Heroku Architecture
    • Compute (Dynos)
      • Dyno Management
      • Dyno Concepts
      • Dyno Behavior
      • Dyno Reference
      • Dyno Troubleshooting
    • Stacks (operating system images)
    • Networking & DNS
    • Platform Policies
    • Platform Principles
  • Developer Tools
    • Command Line
    • Heroku VS Code Extension
  • Deployment
    • Deploying with Git
    • Deploying with Docker
    • Deployment Integrations
  • Continuous Delivery & Integration (Heroku Flow)
    • Continuous Integration
  • Language Support
    • Node.js
      • Working with Node.js
      • Troubleshooting Node.js Apps
      • Node.js Behavior in Heroku
    • Ruby
      • Rails Support
      • Working with Bundler
      • Working with Ruby
      • Ruby Behavior in Heroku
      • Troubleshooting Ruby Apps
    • Python
      • Working with Python
      • Background Jobs in Python
      • Python Behavior in Heroku
      • Working with Django
    • Java
      • Java Behavior in Heroku
      • Working with Java
      • Working with Maven
      • Working with Spring Boot
      • Troubleshooting Java Apps
    • PHP
      • PHP Behavior in Heroku
      • Working with PHP
    • Go
      • Go Dependency Management
    • Scala
    • Clojure
    • .NET
      • Working with .NET
  • Databases & Data Management
    • Heroku Postgres
      • Postgres Basics
      • Postgres Getting Started
      • Postgres Performance
      • Postgres Data Transfer & Preservation
      • Postgres Availability
      • Postgres Special Topics
      • Migrating to Heroku Postgres
    • Heroku Key-Value Store
    • Apache Kafka on Heroku
    • Other Data Stores
  • AI
    • Working with AI
  • Monitoring & Metrics
    • Logging
  • App Performance
  • Add-ons
    • All Add-ons
  • Collaboration
  • Security
    • App Security
    • Identities & Authentication
      • Single Sign-on (SSO)
    • Private Spaces
      • Infrastructure Networking
    • Compliance
  • Heroku Enterprise
    • Enterprise Accounts
    • Enterprise Teams
    • Heroku Connect (Salesforce sync)
      • Heroku Connect Administration
      • Heroku Connect Reference
      • Heroku Connect Troubleshooting
  • Patterns & Best Practices
  • Extending Heroku
    • Platform API
    • App Webhooks
    • Heroku Labs
    • Building Add-ons
      • Add-on Development Tasks
      • Add-on APIs
      • Add-on Guidelines & Requirements
    • Building CLI Plugins
    • Developing Buildpacks
    • Dev Center
  • Accounts & Billing
  • Troubleshooting & Support
  • Integrating with Salesforce
  • Heroku Architecture
  • Compute (Dynos)
  • Dyno Behavior
  • Dyno Startup Behavior

Dyno Startup Behavior

Last updated December 03, 2024

Table of Contents

  • .profile File Commands
  • Local Environment Variables
  • Processes
  • Port Binding of Web Dynos
  • Additional Reading

There are different parts to a dyno’s lifecycle. This article describes a dyno’s startup behavior.

.profile File Commands

During startup, the container starts a bash shell to run any code found in $HOME/.profile before executing the dyno’s command. You can put bash code in this file to manipulate the initial environment, at runtime, for all dynos in your app.

The .profile script is sourced after the app’s config vars. To have the config vars take precedence, use a technique like LANG:

# add vendor binaries to the path
export PATH=$PATH:$HOME/vendor/bin

# set a default LANG if it doesn’t exist in the environment
export LANG=${LANG:-en_US.UTF-8}

For most purposes, config vars are more convenient and flexible than .profile. You don’t need to push code to edit config vars, but you do to edit the .profile file.

Local Environment Variables

The dyno manager sets up a number of default environment variables that you can access in your application.

Cedar-Generation Apps

  • If the dyno is a web dyno, we set the $PORT variable. The dyno must bind to this port number to receive incoming requests.
  • The $DYNO variable set to the dyno identifier. For example, web.1, worker.2, run.9157.
  • The $DYNO variable value isn’t always unique within an app. For example, during a deploy or restart, two running dynos can have the same dyno identifier. The values eventually become consistent during normal operation.

Fir-Generation Apps

  • The $DYNO variable for the dyno identifier won’t have sequential numbers and instead will have an auto-generated unique alpha-numeric string. For example, web-12a34b56d-e78f9, worker-23z34x56y-w78k9
  • If the dyno is a web dyno the process needs to bind on IPv6 addresses on the specified $POST: [::]:$PORT

Processes

After the .profile script executes, the dyno executes the command associated with the process type of the dyno. For example, if the dyno is a web dyno, then the command in the Procfile associated with the web process type executes. Any command executed can spawn additional processes.

Heroku regularly reaps orphan processes to prevent the accumulation of defunct processes.

The maximum number of processes/threads that can exist in a dyno at any one time depends on dyno size.

Port Binding of Web Dynos

A web dyno must bind to its assigned $PORT for Cedar-generation apps, or [::]:$PORT in Fir-generation apps within 60 seconds of startup. If not, the dyno manager terminates it, resulting in a R10 Boot Timeout. Processes can bind to other ports before and after port binding.

If your application requires more time to boot, use the boot timeout tool to increase the limit as a temporary solution. In general, slow boot times make it harder to deploy your application and recovery from dyno failures.

Additional Reading

  • Dyno Lifecycle
  • Dyno Restarts
  • Dyno Shutdown Behavior
  • R10 Boot Timeout

Keep reading

  • Dyno Behavior

Feedback

Log in to submit feedback.

Rolling Deploys Dyno System Clock Synchronization

Information & Support

  • Getting Started
  • Documentation
  • Changelog
  • Compliance Center
  • Training & Education
  • Blog
  • Support Channels
  • Status

Language Reference

  • Node.js
  • Ruby
  • Java
  • PHP
  • Python
  • Go
  • Scala
  • Clojure
  • .NET

Other Resources

  • Careers
  • Elements
  • Products
  • Pricing
  • RSS
    • Dev Center Articles
    • Dev Center Changelog
    • Heroku Blog
    • Heroku News Blog
    • Heroku Engineering Blog
  • Twitter
    • Dev Center Articles
    • Dev Center Changelog
    • Heroku
    • Heroku Status
  • Github
  • LinkedIn
  • © 2025 Salesforce, Inc. All rights reserved. Various trademarks held by their respective owners. Salesforce Tower, 415 Mission Street, 3rd Floor, San Francisco, CA 94105, United States
  • heroku.com
  • Legal
  • Terms of Service
  • Privacy Information
  • Responsible Disclosure
  • Trust
  • Contact
  • Cookie Preferences
  • Your Privacy Choices