Wiki: QnA: Keep your Logic Close and Your Data Closer - How to Share data Between Services
For agents: Markdown version · Wiki index · Explore
- Speaker:
- Event: Reversim Summit 2020
- Video: https://www.youtube.com/watch?v=NmvK4pHUuaw
- Transcript: /transcripts/2020/17-NmvK4pHUuaw.md
- Language: Hebrew and English · Type: talk · Level: intermediate
- Topics: Performance, Data Science, Databases, Distributed Systems
Written by an LLM from machine transcripts. It can contain errors. Check the transcript before you quote it.
Summary
This talk explores architectural patterns and trade-offs for sharing data between microservices using in-memory data grids. The speaker discusses how to balance the need for fast data access and high performance against the coupling introduced by shared state. Through a Q&A session, the audience learns about out-of-heap memory management, serialization overhead, and alternatives like message queues and actor models.
Key points
- 0:00 The speaker explains that off-heap memory resides in the JVM’s memory space but is managed outside of the garbage collection mechanism.
- 1:02 Managing memory off-heap avoids garbage collection pauses, but it introduces overhead due to serialization and deserialization.
- 2:05 Sharing data structures across microservices creates tight coupling, trading traditional database independence for performance gains.
- 3:12 Services share Java libraries and maintain backward compatibility to handle data structures, similar to how they manage other dependencies.
- 4:12 Data can be ingested into the in-memory grid either by querying the source system directly via REST or RPC, or by consuming from a message broker.
- 6:31 Actor models like Akka provide concurrency without locks, but they are not designed to serve as in-memory data grids or general-purpose databases.
- 8:36 Entity version upgrades require shared client libraries that are capable of supporting multiple previous versions across microservices.
- 11:39 Distributed data grids synchronize data across separate JVM instances running in different containers using built-in discovery mechanisms.
Takeaways
- Evaluate whether performance requirements justify the tight coupling of sharing data structures between microservices.
- Understand the trade-offs of using off-heap memory to avoid garbage collection overhead at the cost of serialization complexity.
- Use shared client libraries and backward compatibility strategies when evolving data schemas across distributed services.
Questions this talk answers
- How does using an in-memory data grid compare to traditional messaging queues or caches like Redis for microservices?
- What are the garbage collection and serialization trade-offs of storing state off-heap in a JVM environment?
- How do you handle schema evolution and version upgrades for shared data structures across multiple independent services?
Technologies
Java, JVM, Kafka, Redis, Akka, Cassandra, Docker, Hazelcast
Tags
data sharing, distributed systems, jvm, memory management, microservices, performance