Extending OTP with custom behaviours
summary
Shows exactly how how gen_server is implemented and what the OTP “special process” contract actually requires, walks through concrete callbacks and startup/start_link mechanics, and inspects libraries that reuse the pattern: DBConnection pool checkout semantics, connection reconnect/backoff logic, adapter callbacks for prepare/execute/transactions. Demonstrates building a custom behaviour, highlights real tradeoffs (macros vs callback modules, compilation and debugging costs), and points out practical optimizations like Phoenix Channel handle_out optimization and when native cursors are used.
AI-written summary · about
chapters (7)
- 0:00Start
- 1:09The Plan
- 2:41Two use cases for behaviours
- 4:49OTP Special processes
- 5:52Special process implementation
- 16:15ranch_transport
- 17:13ranch protocol
related talks
20mUsing OTP in Your Phoenix App
34mAnatomy of a Real Time Elixir App
41mElixir & Phoenix – fast, concurrent and explicit
28mOtp In Production: The Nitty-Gritty Details Of Game Servers
48mCoding LiveView
31mOne Binary, Two Ecosystems: Embedding Prometheus Exporters With OCB
41mIn The Loop
48mSynchronizing Game Components
