Space-based architecture
Most systems eventually hit the same wall under heavy load: you can add application servers easily, but they all wait on one database. Space-based architecture removes the database from the request path. Each processing unit holds the application logic and the data it needs in an in-memory data grid, replicated between units. The database is updated asynchronously in the background.
The name comes from tuple spaces, a distributed shared-memory idea from the 1980s. Today the style is implemented with in-memory data grids such as Apache Ignite, Hazelcast, Oracle Coherence or GigaSpaces. It’s a specialized style for extreme and unpredictable load: ticket sales, flash sales, online auctions, bidding and trading platforms.
Diagram
Section titled “Diagram”- A surge of requests arrives, and the messaging grid sends each one to an available processing unit.
- The unit handles the request entirely in memory, with no database call on the way.
- Changes are replicated between units' in-memory grids, so every unit sees the same data.
- Updates flow asynchronously to the database through a data writer, usually via a queue.
How it works
Section titled “How it works”- Processing units contain the business logic, an in-memory data grid with the data that logic needs, and a replication engine. They’re usually deployed as containers or virtual machines.
- Replication between units keeps their grids consistent, either fully replicated (every unit has all data) or partitioned (each unit owns part of the data, with backups).
- Virtualized middleware manages the units: a messaging grid that routes requests, a data grid that coordinates replication, a processing grid for requests that span units, and a deployment manager that starts and stops units with demand.
- Data pumps send changes asynchronously, typically through a message queue, to data writers that update the database. Data readers load data into units when they start.
- Elastic scale. Because no unit waits on the database, adding units adds throughput almost linearly, up to the limits of replication.
- Extreme scalability and elasticity for read- and write-heavy spikes.
- Very low latency, since requests are served from memory.
- The database stops being the bottleneck, and can even be briefly unavailable without stopping requests.
- Complex: replication, collisions between units, cache sizing and recovery all need expertise.
- Data consistency is hard: concurrent updates to the same data in different units can collide, and the database lags behind memory.
- Data loss risk if units fail before changes reach the database, unless the data pump is durable.
- Memory limits and cost: the working data set must fit in memory across units.
- Hard to test realistically, because the behavior that matters only appears at very high load.
When to use it
Section titled “When to use it”- Load that’s both very high and very spiky: concert ticket on-sales, flash sales, auctions, online betting, trading and bidding systems.
- Workloads where a fixed working set (inventory, seats, bids, sessions) fits in memory and must be updated very quickly.
When to avoid it
Section titled “When to avoid it”- Most business applications. Caching, read replicas and queues usually solve the problem far more simply. See scenario: the database is the bottleneck.
- Large data sets that don’t fit in memory, or analytics over long history.
- Systems needing strict, immediate consistency across all data, such as core ledgers.
Common pitfalls
Section titled “Common pitfalls”- Reaching for it too early, before simpler fixes like indexing, caching and partitioning.
- Ignoring collision rates: with full replication, more units and more updates to the same data mean more conflicts.
- A non-durable data pump, so a crash loses updates that were never written.
- Reporting from the database without accounting for its lag behind memory.
In practice
Section titled “In practice”- Scenario: the site falls over at peak, where simpler patterns are usually tried first
- Performance engineering, the only realistic way to validate this style
Related patterns
Section titled “Related patterns”Glossary: eventual consistency, CAP theorem
Further reading
Section titled “Further reading”- Mark Richards and Neal Ford, Fundamentals of Software Architecture (O’Reilly, 2020), chapter on space-based architecture
- Mark Richards, Software Architecture Patterns (O’Reilly report)
- Apache Ignite, Documentation (opens in a new tab)
Written and edited by Abhinav Taduka, enterprise software architect.
New pages are added regularly. Follow Abhinav on LinkedIn to see them first.