ETS
- ETS from Elixir. :ets serves in-memory term storage: millions of concurrent reads beside an owning writer.
- Read concurrency. Tables tuned with read_concurrency serve hot lookups without a process bottleneck.
- Ownership. ETS tables die with their owner: heirs and supervisors make their lifetime a design.
Persistent Data Concepts
- Ecto awareness. Persistence in Elixir usually rides Ecto: changesets validating data on the way to storage.
- Changesets as boundaries. A changeset is the boundary validator: cast, validate, constrain, then persist.
- External stores. BEAM state is fast but ephemeral: durable truth lives in databases, caches rebuilt on boot.
Concurrent State Architecture
- Registry. A Registry maps names to processes: process-per-entity systems findable by key.
- Process per entity. One process per entity: per user, per game, per device: is the BEAM’s signature architecture.
- Read paths versus write paths. Writes serialise through owners; reads scale through ETS: the two-path architecture, measured.
Before and after this level
- Before: Level 11: Distributed Elixir: Nodes, Clustering, Distributed Failure.
- Next: Level 13: Testing: ExUnit, Concurrent Testing, Property-Based Testing Concepts.
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 Elixir Level 12: Data & State cover?
ETS, Persistent Data Concepts, Concurrent State Architecture: 3 lessons and 9 ideas.
What should I know before this level?
The level before it, Level 11: Distributed Elixir, which covers Nodes, Clustering, Distributed Failure.