Elixir Fundamentals interview question · Most asked
What is a GenServer?
Summary
An OTP behaviour for a process that holds state and handles synchronous calls (handle_call), asynchronous casts (handle_cast) and other messages (handle_info). A client API wraps the message passing.
Longer Answer
Run GenServers under supervisors; avoid slow work in callbacks because messages are processed one at a time.
Key Points
- Stateful server process.
- call (sync) vs cast (async).
- Supervised; one message at a time.