ETS
- ETS tables. ETS is in-memory term storage: millions of reads per second, owned by a process, surviving it optionally.
- Table types. Tables come as set, ordered_set and bag: key semantics chosen per table.
- Concurrent access. ETS reads run concurrently across schedulers: the shared-data escape hatch that stays safe.
DETS and Mnesia Concepts
- DETS. DETS persists ETS-style tables to disk: bounded, simple, honest about its limits.
- Mnesia. Mnesia is Erlang’s built-in distributed database: transactions and replication over Erlang terms.
- Choosing storage. Choose by need: ETS for speed, DETS for simple persistence, Mnesia for replicated state: externals beyond.
Concurrent State Design
- Process-owned state. Default design: state lives inside a process: serialised access by mailbox, no locks.
- ETS for hot reads. When thousands read one dataset, a process bottlenecks: ETS serves hot reads beside an owning writer.
- Ownership and heirs. ETS tables die with their owner unless an heir is named: state lifetime designed, not assumed.
Before and after this level
- Before: Level 8: OTP Applications: Applications, Configuration, Dependencies and Releases.
- Next: Level 10: Distributed Erlang: Nodes, Distributed Messaging, Clustering and Network Failure.
In the app each of these ideas is taught and then asked back, and the level ends with a checkpoint and flashcards. See Checkpoints and flashcards.
Frequently asked questions
What does Erlang Level 9: State & Storage cover?
ETS, DETS and Mnesia Concepts, Concurrent State Design: 3 lessons and 9 ideas.
What should I know before this level?
The level before it, Level 8: OTP Applications, which covers Applications, Configuration, Dependencies and Releases.