1. Scalable eCommerce Platform Solutions
Scalable eCommerce Platform Solutions
In-Memory Data Grids Essentials. Oracle Coherence
Vladimir Kondraschenko
Max Myslyvtsev
2. Scalable eCommerce Platform Solutions
About me
Vladimir Kondraschenko
• Lead Java engineer
• More than 10 years of hands on experience in
– software design and coding
– technical leadership
– development management
vkondraschenko@griddynamics.com
5. Scalable eCommerce Platform Solutions
Preconditions of Using IMDG
• Big amounts of data (10-100 GB)
• Low latency
• High availability
• Distributed calculations
6. Scalable eCommerce Platform Solutions
Transport
Local Data
Architecture Layers
Transport
Local Data
Transport
Local Data
Shared Data
7. Scalable eCommerce Platform SolutionsScalable eCommerce Platform Solutions
Transport Layer
Discovery and communication
21. Scalable eCommerce Platform Solutions
Cache Topology
• Replicated
Storage 1
A
D
B
E
C
F
Storage 2
A
D
B
E
C
F
Storage 3
A
D
B
E
C
F
Storage 1
A
D
B
E
Storage 2
C
A
D
F
Storage 3
E
B
F
C
• Partitioned
22. Scalable eCommerce Platform Solutions
Storage 3
Repartitioning
Storage 1
A
D
B
E
Storage 3
E
B
F
CE
Storage 2
C
A
D
FF
FCEB
25. Scalable eCommerce Platform Solutions
Key hashing
Cache Operations: Put/Get
Storage 1 Storage 2
Client
Primary A
A B C D E F
• Client knows responsible storage
– Key hash is used to find it
• Automatic backups
Backup A
Backup F Primary F
26. Scalable eCommerce Platform Solutions
Storage 2Storage 2Storage 1
Cache Operations: Query
• Broadcast request
– Unless Query is Key-Associated
• All entries are evaluated
– Unless Indexes are used
field1=10 or field2>70field1=10 and key=A
key:
field1:
field2:
D
70
80
key:
field1:
field2:
C
50
60
key:
field1:
field2:
B
30
40
key:
field1:
field2:
D
70
80
key:
field1:
field2:
C
50
60
key:
field1:
field2:
B
30
40
key:
field1:
field2:
A
10
20
27. Scalable eCommerce Platform Solutions
Cache Operations: Invocation/Entry Processor
• Task is serialized and distributed
– May contain additional data
• Configurable execution scope
– Specific nodes
– All nodes
– Nodes bound to data
Node 1 Node 2
Task Task
Client
Task
28. Scalable eCommerce Platform Solutions
• Data-bound mapping
– By keys
– By Query
• Parallel execution
Storage 2Storage 1
key:
field1:
field2:
A
10
20
key:
field1:
field2:
B
30
40
key:
field1:
field2:
C
50
60
key:
field1:
field2:
D
70
80
Cache Operations: Map-Reduce
sum(field2) where field1>20
40 60 80
180
key:
field1:
field2:
A
10
20
140
32. Scalable eCommerce Platform SolutionsScalable eCommerce Platform Solutions
Local Data Layer
Node-specific data
33. Scalable eCommerce Platform Solutions
Storage Storage
Node
Near Caching
• Local access by primary key
• Lazy population
• Invalidation
– On entry change
– By timeout
Near Cache
Distributed Cache
A
A B
34. Scalable eCommerce Platform Solutions
Continuous Caching
• Local access by any Query
• Eager population
• Near real-time data
Storage Storage
Node
Continuous Cache
Distributed Cache
A B
A B
35. Scalable eCommerce Platform SolutionsScalable eCommerce Platform Solutions
Tips
Using Oracle Coherence in practice
36. Scalable eCommerce Platform Solutions
Before integrating Oracle Coherence
• Do I really need IMDG or just a cache?
• How large my cluster should be?
• How much heap memory should be
configured for each node?
• What GC configuration to use?
• Do I have a relevant environment
to test my application?
37. Scalable eCommerce Platform Solutions
Memory usage
Limit cache size
• By binary size (per node)
• By number of objects in cache (per node)
Estimate cache object memory consumption
• Use BinaryMemoryCalculator
• Remember about backup copies
• Cache listeners (near cache, custom)
38. Scalable eCommerce Platform Solutions
Investigation & troubleshooting
• Coherence Management Framework (JMX)
– view cluster and nodes settings
– list caches (front and back) on each node
– view cache dynamic metrics
• Coherence command-line tool
– manage cache services
– manipulate cache data
• Profiling and heap analysis
– analyze heap dump
– analyze GC logs