Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Scan for outdated or missing drivers - takes under a minute3Repair Windows errors before they cause bigger problemsOTP is the set of conventions and behaviours Elixir uses to organize concurrent processes and manage their lifecycles. A typical application uses GenServer for request-handling processes, supervisors to restart failed children, and an OTP application to start the top-level supervision tree. You do not need to adopt every OTP feature at once, but these pieces are central to building Elixir services that can recover in a controlled way.
What OTP means in an Elixir project
OTP is not a single library or framework layer that replaces Elixir. It is a collection of established behaviours and runtime conventions for structuring concurrent programs. In everyday Elixir work, three pieces are especially useful to understand:
- GenServer: a common behaviour for implementing a process that handles requests and maintains state.
- Supervisor: a process that starts, stops, and monitors child processes, and applies the restart rules declared for them.
- OTP application: a runtime unit that can be started or stopped as a whole and that typically starts the top-level supervisor for its processes.
Mix and OTP applications are related, but they are not the same thing. Mix manages project tasks such as compiling and testing; an OTP application is the runtime unit the Erlang VM starts and stops. Elixir’s Getting Started guide to Mix and OTP explains how these concepts fit together.
How a GenServer handles requests
A GenServer process can receive requests from client code while keeping its state inside the process. The client-facing choice between a call and a cast determines what acknowledgement the caller gets.
#1 Best Overall
GenServer.call/3 waits for a reply
A call waits for the server to respond, so the caller gets a reply from the request-handling path. This makes calls appropriate when the caller needs a result or needs to know that the server handled the request before proceeding.
GenServer.cast/2 does not confirm processing
A cast returns without waiting for the server to confirm it handled the message. That asynchronous contract can be useful when the sender does not need an immediate reply. Its return alone, however, does not prove that the operation completed. A subsequent successful call can establish that the server is responding and, in the guide’s example, that earlier work has been processed. Neither choice is inherently unsafe; choose according to whether the sender needs an acknowledgement. See the official GenServer guide.
How supervisors recover from process failure
A supervisor starts child processes from their child specifications, monitors them, and applies the declared response when one terminates. The Erlang/OTP Design Principles guide describes the supervisor’s responsibility as “starting, stopping and monitoring its child processes.”
Child specifications are started in order and terminated in reverse order. Restart strategy determines how broadly a failure affects sibling processes:
Recommended Free Tools
Rank #3
| Strategy | What happens after a child terminates | When it fits |
|---|---|---|
:one_for_one |
Only the terminated child is restarted. | Use when siblings can recover independently. |
:one_for_all |
All children are terminated and then restarted. | Use when the children form a tightly coupled unit that must restart together. |
:rest_for_one |
The terminated child and the children started after it are terminated and restarted. | Use when later children depend on earlier children in start order. |
These are design choices, not universal rankings. Consider which processes depend on one another and whether a coordinated restart is necessary for correctness. For example, if a later child depends on a connection or service started earlier in the same supervisor, :rest_for_one can encode that relationship: when the earlier child fails, dependent later children restart too.
Restart intensity limits repeated failure
Supervisors also have a restart-intensity limit: a maximum number of restarts within a configured time window. If that limit is exceeded, the supervisor terminates its children and itself. A higher-level supervisor can then take responsibility for recovery. This prevents a process that repeatedly fails for the same reason from restarting indefinitely.
How an OTP application starts the supervision tree
An OTP application’s callback can return a supervisor process as its top-level process. At startup, the runtime starts the application and its configured dependencies; the supervision tree then provides the structure for starting and recovering the application’s child processes. This is how GenServers and other supervised processes become part of an application rather than isolated processes started ad hoc. The Elixir supervisor and application guide walks through this arrangement.
The relationship is useful to keep straight: Mix helps you work on the project, while the OTP application defines a runtime unit. Starting the application starts its dependencies and application callback; stopping it treats that runtime unit as a whole.
Free tools Windows power users keep installed
One-click scans. No signup required.
Best Value
Do you need OTP for an Elixir app?
If an Elixir program has processes that need supervision, managed state, or coordinated startup and shutdown, OTP provides the standard building blocks for those responsibilities. A small script may not need a complex supervision tree, but learning GenServer and supervisors becomes valuable when an application’s processes must keep running, recover from crashes, or depend on one another.
You can learn the ideas incrementally: first understand processes and GenServer request semantics, then supervise related processes, and finally connect the tree to the application callback. When choosing a strategy, base it on actual process dependencies rather than selecting the most comprehensive-sounding option.
Elixir and Erlang/OTP compatibility
At the time of the official documentation snapshot used here, the Elixir documentation labeled Elixir v1.20.4 stable and listed Erlang/OTP versions 27, 28, and 29 as supported. Compatibility changes with releases, so check the official Elixir documentation for the Elixir version you install. Its versioned documentation is also useful when a project is on an older release; do not assume every current API or instruction applies unchanged to it.
Where to continue learning
The official Elixir Learning page collects books, courses, videos, and other resources. For a book-length treatment, the publisher’s contents for Elixir in Action, Third Edition include generic server processes and GenServer, fault tolerance and supervisors, supervision trees and dynamic supervision, OTP applications, releases, and distributed systems.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




