Web / Apache OFBiz Interview questions
How does Distributed Cache Clear (DCC) keep entity caches consistent across a cluster?
When multiple OFBiz instances point at the same database, each instance keeps its own in-memory Entity Engine cache - a write on one node wouldn't otherwise be visible to another node's cache. Distributed Cache Clear solves this by broadcasting a cache-invalidation message to every other configured instance whenever a write happens on one node.
sequenceDiagram
participant NodeA
participant NodeB
participant NodeC
NodeA->>NodeA: Entity write (create/store/remove)
NodeA->>NodeB: DCC notification, clear cache for entity X
NodeA->>NodeC: DCC notification, clear cache for entity X
NodeB->>NodeB: Evict cached entries for entity X
NodeC->>NodeC: Evict cached entries for entity X
Each instance is registered with the others' endpoints in configuration, and the DCC mechanism itself runs as a special service triggered automatically by the Entity Engine's write operations, so application code doesn't need to call it explicitly for normal entity writes.
More Related questions...