Course contentsShow
← Software Engineering
Lesson 751 of 1,93323. Configuration ManagementFree lesson

Processes and Port Binding Factors

Running apps as stateless processes and exporting services via port binding rather than runtime injection.

Processes and Port Binding Factors

You'll learn why apps should run as stateless processes and bind to ports rather than rely on web servers injected at runtime.

Stateless Processes

The Processes factor says your application should execute as one or more stateless processes. This means any data that needs to persist across requests must be stored in a backing service (like a database), not in memory or on the local filesystem.

Think of your app like a cashier at a busy store. Each transaction is independent—the cashier doesn't need to remember your previous visit. If they take a break and another cashier replaces them, the store functions the same way. That's stateless.

Why? Processes can crash, restart, or scale horizontally (multiple instances running). If session data lives in memory, restarting loses it. Users experience broken sessions. Stateless processes avoid this entirely—state lives in Redis, a database, or similar backing services you learned about earlier.

Port Binding

The Port Binding factor requires your app to be self-contained and export services by binding to a port. Your app should not depend on a web server (like Apache or IIS) being injected into the runtime environment.

Instead, your application includes its own HTTP server library and listens on a port specified via environment variables (like PORT=8080). When deployed, the platform routes traffic to that port.

This makes your app portable. It runs the same way locally (listening on localhost:3000) and in production (listening on the assigned port). No external runtime dependency—just your process and a port number from configuration.

Key Takeaway:
Run apps as stateless processes that store no session data in memory, and make them self-contained by binding directly to a port rather than depending on an injected web server.