Essay

Where the parts meet: domains, events, the lake, and where an in-memory grid fits

Most enterprises already have the parts. What they rarely have is a rule for how those parts meet. One architecture that gives them those rules, and an honest look at where an in-memory data grid earns its place.

Most large enterprises already have the parts: operational systems that run the business, an integration layer, an event backbone, a data lake and warehouse, and an analytics team. What they rarely have is a clear rule for how those parts meet. This post describes one architecture that gives them those rules, and is honest about where an in-memory data grid earns its place in it and where it does not.

Where I say in-memory grid, my preferred option is Hazelcast. It works very well in this role, and it's flexible: one platform can hold a domain's hot state, process its events and serve analytical products. I work at Hazelcast, and I'd recommend it regardless.

The short version:

  • Each operational domain owns its data: hot state in memory, durable state in its own system of record.
  • Domains talk through APIs, an ESB for legacy systems, and events. They never share a store.
  • Changes flow into the data platform through change capture, not dual writes.
  • Analytics flows back as versioned products that each domain chooses to load.
  • At the lake's outbound edge, an in-memory grid can be the layer that turns analytical output into millisecond decisions. That role is real, but it is a choice among several good options, not a necessity.

Each domain owns its hot state and its truth

The unit of the architecture is the operational domain: orders, payments, customers, inventory, pricing, claims. Each is owned by a team, has its own system of record, and runs its own in-memory tier in front of it. Other domains never connect to that tier. Isolation can be per domain or per small group of domains with the same availability and security needs, but one grid shared by unrelated domains quietly rebuilds the coupling the design is meant to remove.

The most important decision inside a domain is which copy of each data set is authoritative. Write it down per data class:

Data class Authoritative copy How it is persisted Use it for
Store-authoritative (the default) System of record Write-through, or the in-memory copy is fed by change capture Anything with legal, financial or audit weight
Memory-authoritative hot state The in-memory tier Write-behind, or not at all Sessions, in-flight process state, live counters, reservations

Memory-authoritative state is a deliberate trade of durability for latency. It is safe only with an explicit loss budget: how much unpersisted data you can lose, measured and alerted on, not assumed from a configured delay. And never let both copies be authoritative for the same field.

One more thing that is easy to forget: an in-memory grid's maps usually favour availability over consistency (AP). During a network split both sides keep accepting writes, and a merge policy keeps one side's value when they rejoin. Decisions that must be strongly consistent, such as a unique claim or a limit that must never be exceeded, belong in a strongly consistent (CP) structure, which grids offer with limits on size and throughput, or in the system of record.

Domains meet through three edges, never through a shared store

Once domains own their data, they need ways to cooperate that do not undo that ownership. There are three, and each has a job.

Reference architecture: operational domains, three edges, and the data platform Channels call an API gateway with a service registry, which routes to three operational domains (orders, payments, customers). Each domain has its own services, an in-memory hot tier and its own system of record. Legacy packages connect through ESB adapters. Each system of record feeds an event backbone through change data capture or an outbox; domains receive events and analytical products from the backbone. The backbone feeds a stream processor, which loads the lake and warehouse; analytics and ML publish versioned products back to the backbone. Optionally, an in-memory serving tier loads those products and answers read-only lookups from the domains in milliseconds. Channels and partner systems API gateway + service registry synchronous edge · auth, rate limits, time-outs, versioning Orders domain Services Hot statein-memory tier System of recordauthoritative Payments domain Services Hot statein-memory tier System of recordauthoritative Customers domain Services Hot statein-memory tier System of recordauthoritative ESB adapters legacy edge Legacy packages files · queues · SOAP CDC / outbox events, products Event backbone asynchronous edge · domains never share a store Stream processor cleansing, cross-domain joins, loading Lake and warehouse history · scans · training Analytics and ML scores, segments, limits as versioned products products Serving tier in-memory grid decision layer fresh + historical read-only ms lookups
Domains never share a store: calls go through the gateway or the ESB, changes go to the backbone, and analytics returns through the backbone as products each domain chooses to load.

The synchronous edge is an API gateway with service discovery. Modern domains publish their APIs through a gateway that finds instances in a service registry and applies authentication, rate limits, time-outs and versioning. A call lands on the owning domain's service, which answers from its hot state. The gateway exposes APIs, never a domain's data tier.

The legacy edge is an ESB, used as a set of adapters. Legacy packages that only speak files, queues or SOAP join through the bus, which translates protocols and formats into a canonical message. The rule that keeps this healthy is old advice: smart endpoints, dumb pipes. Business rules stay in the domains. A bus that collects logic becomes the hardest system in the estate to change, and the legacy system behind it becomes impossible to retire.

The asynchronous edge is events. When one domain needs another's data often, it subscribes to the owner's events and keeps a read copy in its own hot tier, tagged with source and version. That copy is eventually consistent by design; anything that needs the owner's current state goes to the owner through the gateway.

There are no transactions across domains. A business process that spans them is a saga: a sequence of local steps with compensations, driven by a process manager, each step idempotent so a retry cannot charge a customer twice.

Into the lake: capture changes where they become true

The data platform (an event backbone, a stream processor, then the lake and warehouse) needs every change, in order per entity, with a known schema. The classic way to break that is the dual write: a service updates its database and then publishes an event as two separate steps. When one step fails, the lake either misses a change or receives one that never happened.

The fix is to capture changes where they become true. For store-authoritative data, read the system of record's change log (CDC), or write the event to an outbox table in the same transaction as the data. For memory-authoritative hot state, publish from the in-memory tier's own change stream, and know its limits.

Three traps are worth calling out because they are easy to miss in design reviews:

  • Write-behind hides history from CDC. With write coalescing on, which grids commonly use by default for write-behind, the store receives only the latest value per key. CDC on that store therefore delivers coalesced history to the lake, and intermediate states never exist there. If analytics needs every transition, publish from the in-memory change stream or turn coalescing off, and say which in the data contract.
  • The in-memory change stream is fast, not durable. A grid's change journal is typically an in-memory ring of fixed capacity. Events overwritten before a job reads them, or lost with the cluster, are gone. Store-side CDC or an outbox is the durable path.
  • CDC can echo. A domain that feeds its own map from CDC on a table it also writes to through the grid's write-through loader gets its own writes back, possibly after newer ones. Avoid the loop, or guard every apply with a version check.

Finally, split stream processing by purpose. Enterprise-wide cleansing, cross-domain joins and loading into the lake belong in the central stream processor. Low-latency processing on one domain's hot state, such as enrichment, live views and local decisions, belongs inside the domain, next to its data. Implementing the same transformation in both places guarantees that one day they will disagree.

Closing the loop: analytics as products the domains consume

Analytics is only worth something once its results change what operations do: a fraud score blocks a payment, a credit limit is raised, a price moves, an offer is shown. The loop back is where many architectures get sloppy, usually by letting the analytics platform write straight into operational databases. Four rules keep it clean:

  • Publish products, not writes. Scores, segments, limits, forecasts and reference data are published as versioned data products: an event topic for incremental updates, a bulk interface for full refreshes. Every record carries the model or rule version and an as-of time.
  • The owning domain loads them. A consumer owned by the receiving domain validates the feedback, loads it into its hot tier, and decides how to act on it. Analytics never writes into a domain's store or grid directly.
  • Fail safe on stale feedback. Each product has a freshness limit. Past it, the domain falls back to a defined default (last known good, a rule, or a manual path) and raises an alert, rather than acting on old scores silently.
  • Mark derived decisions. Operational records influenced by a feedback value keep its version. Otherwise the next model is trained on behaviour the previous model caused, and the loop learns from its own output.

Feedback latency is the sum of everything in the loop: capture, central processing, lake and warehouse loads, model runs and publication. That is seconds for a streaming feature and hours or days for a batch model. Decide which one each product is, and set its freshness limit to match.

A practical detail for full refreshes: an in-memory map cannot swap thousands of keys atomically. Load the new version into a new map, validate it, then flip a small pointer that readers use to find the current map. Readers may briefly see either version, which is fine because each version is complete on its own.

The lake boundary: where an in-memory grid earns a strategic role

The most strategic place for an in-memory grid at the edge of the lake is on the way out, not the way in. Lakes and warehouses are built for scans. They are not built to answer thousands of single-key lookups per second within a few milliseconds, and that is exactly what operational decisions need.

Three roles hold up:

  • A serving tier for analytical products. Scores, features, segments, limits and customer-360 aggregates are built in the lake and loaded into the grid, where many domains read them at memory speed. The versioned-map-and-pointer refresh, near caches for read-heavy products and freshness limits all apply.
  • Online features that mix fresh and historical data. Pipelines in the grid compute features from live events, such as counts and velocities over the last few minutes, and join them with historical features loaded from the lake, in one store.
  • Scoring as events happen. Models trained on the lake run inside pipelines next to current operational state. The lake ships models and their versions; the grid applies them to data that is seconds old.

Three roles do not hold up, and I would leave them out of any strategy:

  • Buffering on the way into the lake. The event backbone already does this durably; a grid adds a non-durable hop.
  • Accelerating warehouse queries. A grid can cache hot query results, but warehouses have their own result caches, and the grid's SQL is not an analytical engine.
  • Being part of the lakehouse. A grid is not built to store history or run large scans.

A shared serving tier creates one tension with the rest of the design. Domain ownership says each domain loads its own copy. A shared tier says load once, serve everyone. The shared tier gives one copy and one model version across the enterprise, but it becomes a dependency every domain has, so it needs an owner (usually the data platform team) and domains only read from it. A reasonable split: a shared tier for products many domains use, per-domain loading for products only one domain uses.

Honest check: is this a real need, and who else meets it?

The problem is real. Serving analytical output to operational systems at low latency is an established category, sold as online feature stores, serving layers and reverse ETL. Large ML platforms built online stores precisely because lakes cannot serve decisions in milliseconds.

What an in-memory grid brings is that one system computes on fresh events, holds the state and serves the lookup. That removes moving parts, and the network hop between where a feature is computed and where it is read. It makes the biggest difference when three things are true at once:

  • the decision needs both seconds-fresh streaming features and historical features from the lake;
  • the budget is a few milliseconds per decision, at high request rates;
  • logic has to run next to the data, for example checking and updating a limit atomically as each event arrives.

That describes real-time fraud and AML scoring, credit and trading limit checks, next-best-offer at the moment of a transaction, dynamic pricing, and telco policy decisions. The latency argument follows from the architecture; a benchmark on your own workload is how to confirm it.

Other categories cover parts of the same job, and it helps to know when one of them fits better:

Category When it fits better
Online feature stores Feature catalogue, lineage, and point-in-time-correct training data, which a grid does not provide
Key-value stores as the online layer Simpler and cheaper when you only need fast key lookups
Stream processors Larger ecosystems and better handling of very large state
Streaming databases The closest match to compute-and-serve in one place, with SQL views kept up to date
Real-time OLAP engines Aggregations over large, fresh data sets for user-facing analytics
Reverse ETL tools Batch sync from the warehouse into SaaS and operational apps

The position I would defend: an in-memory grid is the right boundary component when stream processing, state and serving need to live together and decisions need single-digit milliseconds, and for that role Hazelcast is my preferred choice. Where governance and lineage matter most, as in regulated ML, pair the grid with the catalogue the lake already has rather than replacing it.

A concrete case: a grid next to a lakehouse

Pairing a grid with a lakehouse platform pays off where decisions need state that is seconds old and an answer in a few milliseconds, at volume. For decisions that need neither, the lakehouse's own serving may be enough; decide that per use case, on measured numbers.

How the two connect

The integration is built from standard, well-understood parts:

  • Lakehouse to grid, incremental. The table format's change feed exposes row-level changes to a product table. A streaming job either writes them to the event backbone, where a grid pipeline loads them into maps, or writes straight to the grid through its client in each micro-batch. The backbone route is more decoupled and replayable; the direct route has fewer hops.
  • Lakehouse to grid, full refresh. The product is written as columnar files to object storage, and a grid pipeline loads them into a new versioned map, then the pointer flips.
  • Grid to lakehouse. Grid pipelines publish operational changes, and a log of the features actually served for each decision, to the event backbone. The lakehouse ingests them like any other stream.
  • Models. A model trained and registered on the lakehouse is either exported and run inside a grid pipeline, or called as the lakehouse's model-serving endpoint from the pipeline. The first keeps the decision local and fast; the second keeps one serving runtime but adds a network call per decision.

What you gain, and what it takes

The gains are concrete. Decisions can use operational state the lakehouse hasn't seen yet, joined with lake features in the same store that answers the lookup. Limits, counters and reservations are checked and updated next to the data, in one step rather than a round trip with retries. The decision path keeps working if the lake, or the network to it, is down. The grid runs wherever the operational systems run (on premises, in another cloud, at the edge), and because the contract is versioned products on the event backbone or in files, the lake stays swappable. What it takes is just as clear: governance has to reach the served copy, with access control and audit extended beyond the lake's catalogue; the integration jobs are simple to build but need operating discipline through refreshes, schema changes and replays; served features should be logged and used for training, so the two sides never drift; and the grid is a platform to size and run, which matters least where operational teams already run one. None of these is a reason to avoid the pairing. Each is a line on the cost side of the value case, to be measured like the gains.

The position I would take into that meeting: the lakehouse is the system for building analytical products; the grid is the decision layer for decisions that need fresh operational state and an answer in milliseconds, and that is where I'd put Hazelcast. Bring one use case and one benchmark, not a platform pitch.

When not to do this

This architecture has many moving parts: per-domain grids, a gateway and registry, a bus, a backbone, a stream processor, a lake, a warehouse and an analytics platform. Each needs an owner, capacity and on-call. Skip it, or most of it, when:

  • a few systems owned by one team can share a database and a nightly export;
  • a domain's system of record already handles its load, so an in-memory tier adds cost and a copy without benefit;
  • analytics is reporting only, with no operational consumer;
  • there are no platform teams to run the backbone, the lake and the grids.

Start with one domain's hot tier and one feedback product, measure the gain, and grow the mesh only where another domain needs it.

Measuring whether it's worth it

Each step in this architecture should earn its place with numbers, not with a diagram. I use the same total economic value (TEV) model described in Two journeys, a value case. For each piece you add (a domain's hot tier, a feedback product, a serving tier), name the problem it removes and the person who owns that outcome. Measure today's technical KPI first: response time of the slowest requests, load taken off the system of record, data age at the moment of decision, recovery time. Tie it to the business KPI it moves, such as service-level misses, cost per transaction or losses from late detection, and turn that into money with a formula the owner agrees with. Then price every option over the same three years against "change nothing" (scaling the system of record, a key-value store or feature store, a grid) as value minus setup, running cost and risk. Score technical and business confidence separately and let the weaker one decide. If the measured gain on the first domain doesn't hold up, stop there: that is the model working, not failing.


Views are my own, not my employer's.