in-memory data grids essentials. oracle coherence
DESCRIPTION
TRANSCRIPT
![Page 1: In-Memory Data Grids Essentials. Oracle Coherence](https://reader033.vdocument.in/reader033/viewer/2022061110/545170e5af795902348b8a0f/html5/thumbnails/1.jpg)
Scalable eCommerce Platform Solutions
Scalable eCommerce Platform Solutions
In-Memory Data Grids Essentials. Oracle CoherenceVladimir KondraschenkoMax Myslyvtsev
![Page 2: In-Memory Data Grids Essentials. Oracle Coherence](https://reader033.vdocument.in/reader033/viewer/2022061110/545170e5af795902348b8a0f/html5/thumbnails/2.jpg)
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
![Page 3: In-Memory Data Grids Essentials. Oracle Coherence](https://reader033.vdocument.in/reader033/viewer/2022061110/545170e5af795902348b8a0f/html5/thumbnails/3.jpg)
Scalable eCommerce Platform Solutions
Agenda
• Preconditions of using IMDG• Architecture overview– topology– distributed cache layer– local cache layer
• Cache operations• Persistence integration• Tips
![Page 4: In-Memory Data Grids Essentials. Oracle Coherence](https://reader033.vdocument.in/reader033/viewer/2022061110/545170e5af795902348b8a0f/html5/thumbnails/4.jpg)
Scalable eCommerce Platform Solutions
Different Solutions
Coherence
![Page 5: In-Memory Data Grids Essentials. Oracle Coherence](https://reader033.vdocument.in/reader033/viewer/2022061110/545170e5af795902348b8a0f/html5/thumbnails/5.jpg)
Scalable eCommerce Platform Solutions
Preconditions of Using IMDG
• Big amounts of data (10-100 GB)• Low latency• High availability• Distributed calculations
![Page 6: In-Memory Data Grids Essentials. Oracle Coherence](https://reader033.vdocument.in/reader033/viewer/2022061110/545170e5af795902348b8a0f/html5/thumbnails/6.jpg)
Scalable eCommerce Platform Solutions
Transport
Local Data
Architecture Layers
Transport
Local Data
Transport
Local Data
Transport
Local Data
Transport
Local Data
Shared Data
![Page 7: In-Memory Data Grids Essentials. Oracle Coherence](https://reader033.vdocument.in/reader033/viewer/2022061110/545170e5af795902348b8a0f/html5/thumbnails/7.jpg)
Scalable eCommerce Platform SolutionsScalable eCommerce Platform Solutions
Transport LayerDiscovery and communication
![Page 8: In-Memory Data Grids Essentials. Oracle Coherence](https://reader033.vdocument.in/reader033/viewer/2022061110/545170e5af795902348b8a0f/html5/thumbnails/8.jpg)
Scalable eCommerce Platform Solutions
IMDG Topology
![Page 9: In-Memory Data Grids Essentials. Oracle Coherence](https://reader033.vdocument.in/reader033/viewer/2022061110/545170e5af795902348b8a0f/html5/thumbnails/9.jpg)
Scalable eCommerce Platform Solutions
Discovery• Multicast• Well-known address
![Page 10: In-Memory Data Grids Essentials. Oracle Coherence](https://reader033.vdocument.in/reader033/viewer/2022061110/545170e5af795902348b8a0f/html5/thumbnails/10.jpg)
Scalable eCommerce Platform Solutions
Discovery• Multicast• Well-known address
New
![Page 11: In-Memory Data Grids Essentials. Oracle Coherence](https://reader033.vdocument.in/reader033/viewer/2022061110/545170e5af795902348b8a0f/html5/thumbnails/11.jpg)
Scalable eCommerce Platform Solutions
Discovery• Multicast• Well-known address
WKA
WKA
New
![Page 12: In-Memory Data Grids Essentials. Oracle Coherence](https://reader033.vdocument.in/reader033/viewer/2022061110/545170e5af795902348b8a0f/html5/thumbnails/12.jpg)
Scalable eCommerce Platform Solutions
Communication• Custom protocols over TCP or UDP• Senior node• Heartbeats
– Cluster heartbeats– Node heartbeats
Senior
![Page 13: In-Memory Data Grids Essentials. Oracle Coherence](https://reader033.vdocument.in/reader033/viewer/2022061110/545170e5af795902348b8a0f/html5/thumbnails/13.jpg)
Scalable eCommerce Platform Solutions
Communication• Custom protocols over TCP or UDP• Senior node• Heartbeats
– Cluster heartbeats– Node heartbeats
Senior
![Page 14: In-Memory Data Grids Essentials. Oracle Coherence](https://reader033.vdocument.in/reader033/viewer/2022061110/545170e5af795902348b8a0f/html5/thumbnails/14.jpg)
Scalable eCommerce Platform Solutions
Communication• Custom protocols over TCP or UDP• Senior node• Heartbeats
– Cluster heartbeats– Node heartbeats
Senior
![Page 15: In-Memory Data Grids Essentials. Oracle Coherence](https://reader033.vdocument.in/reader033/viewer/2022061110/545170e5af795902348b8a0f/html5/thumbnails/15.jpg)
Scalable eCommerce Platform Solutions
Node Departure• TCP Ring• IP monitor• Timeout
![Page 16: In-Memory Data Grids Essentials. Oracle Coherence](https://reader033.vdocument.in/reader033/viewer/2022061110/545170e5af795902348b8a0f/html5/thumbnails/16.jpg)
Scalable eCommerce Platform Solutions
Node Departure• TCP Ring• IP monitor• Timeouts
![Page 17: In-Memory Data Grids Essentials. Oracle Coherence](https://reader033.vdocument.in/reader033/viewer/2022061110/545170e5af795902348b8a0f/html5/thumbnails/17.jpg)
Scalable eCommerce Platform Solutions
Node Departure• TCP Ring• IP monitor• Timeouts
Box1: IP 177.230.14.5
IP ping
![Page 18: In-Memory Data Grids Essentials. Oracle Coherence](https://reader033.vdocument.in/reader033/viewer/2022061110/545170e5af795902348b8a0f/html5/thumbnails/18.jpg)
Scalable eCommerce Platform Solutions
Node Departure• TCP Ring• IP monitor• Timeout
![Page 19: In-Memory Data Grids Essentials. Oracle Coherence](https://reader033.vdocument.in/reader033/viewer/2022061110/545170e5af795902348b8a0f/html5/thumbnails/19.jpg)
Scalable eCommerce Platform SolutionsScalable eCommerce Platform Solutions
Shared Data LayerCluster-wide data
![Page 20: In-Memory Data Grids Essentials. Oracle Coherence](https://reader033.vdocument.in/reader033/viewer/2022061110/545170e5af795902348b8a0f/html5/thumbnails/20.jpg)
Scalable eCommerce Platform Solutions
Distributed Cache
Cluster
Client Node
Cache Interface
Storage Node
Data Storage
Cache Interface
![Page 21: In-Memory Data Grids Essentials. Oracle Coherence](https://reader033.vdocument.in/reader033/viewer/2022061110/545170e5af795902348b8a0f/html5/thumbnails/21.jpg)
Scalable eCommerce Platform Solutions
Cache Topology
• ReplicatedStorage 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
![Page 22: In-Memory Data Grids Essentials. Oracle Coherence](https://reader033.vdocument.in/reader033/viewer/2022061110/545170e5af795902348b8a0f/html5/thumbnails/22.jpg)
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
![Page 23: In-Memory Data Grids Essentials. Oracle Coherence](https://reader033.vdocument.in/reader033/viewer/2022061110/545170e5af795902348b8a0f/html5/thumbnails/23.jpg)
Scalable eCommerce Platform Solutions
CAP Theorem
C
A
P
Coherence Coherence
![Page 24: In-Memory Data Grids Essentials. Oracle Coherence](https://reader033.vdocument.in/reader033/viewer/2022061110/545170e5af795902348b8a0f/html5/thumbnails/24.jpg)
Scalable eCommerce Platform SolutionsScalable eCommerce Platform Solutions
Get/Put/Remove, Query, Invocation, Map-Reduce
Cache operations
![Page 25: In-Memory Data Grids Essentials. Oracle Coherence](https://reader033.vdocument.in/reader033/viewer/2022061110/545170e5af795902348b8a0f/html5/thumbnails/25.jpg)
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
![Page 26: In-Memory Data Grids Essentials. Oracle Coherence](https://reader033.vdocument.in/reader033/viewer/2022061110/545170e5af795902348b8a0f/html5/thumbnails/26.jpg)
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:
D7080
key:field1:field2:
C5060
key:field1:field2:
B3040
key:field1:field2:
D7080
key:field1:field2:
C5060
key:field1:field2:
B3040
key:field1:field2:
A1020
![Page 27: In-Memory Data Grids Essentials. Oracle Coherence](https://reader033.vdocument.in/reader033/viewer/2022061110/545170e5af795902348b8a0f/html5/thumbnails/27.jpg)
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
![Page 28: In-Memory Data Grids Essentials. Oracle Coherence](https://reader033.vdocument.in/reader033/viewer/2022061110/545170e5af795902348b8a0f/html5/thumbnails/28.jpg)
Scalable eCommerce Platform Solutions
• Data-bound mapping– By keys– By Query
• Parallel execution
Storage 2Storage 1
key:field1:field2:
A1020
key:field1:field2:
B3040
key:field1:field2:
C5060
key:field1:field2:
D7080
Cache Operations: Map-Reduce
sum(field2) where field1>20
40 60 80
180
key:field1:field2:
A1020
140
![Page 29: In-Memory Data Grids Essentials. Oracle Coherence](https://reader033.vdocument.in/reader033/viewer/2022061110/545170e5af795902348b8a0f/html5/thumbnails/29.jpg)
Scalable eCommerce Platform SolutionsScalable eCommerce Platform Solutions
Persistence integration
![Page 30: In-Memory Data Grids Essentials. Oracle Coherence](https://reader033.vdocument.in/reader033/viewer/2022061110/545170e5af795902348b8a0f/html5/thumbnails/30.jpg)
Scalable eCommerce Platform Solutions
Synchronous Persistence Integration
• Read-through
• Write-through
StorageClient Durable Storage
Data Grid
Client Durable Storage
Data GridStorage
![Page 31: In-Memory Data Grids Essentials. Oracle Coherence](https://reader033.vdocument.in/reader033/viewer/2022061110/545170e5af795902348b8a0f/html5/thumbnails/31.jpg)
Scalable eCommerce Platform Solutions
• Refresh-ahead
• Write-behind
Asynchronous Persistence Integration
Storage QueueClient Durable Storage
Data Grid
Storage QueueClient Durable Storage
Data Grid
![Page 32: In-Memory Data Grids Essentials. Oracle Coherence](https://reader033.vdocument.in/reader033/viewer/2022061110/545170e5af795902348b8a0f/html5/thumbnails/32.jpg)
Scalable eCommerce Platform SolutionsScalable eCommerce Platform Solutions
Local Data LayerNode-specific data
![Page 33: In-Memory Data Grids Essentials. Oracle Coherence](https://reader033.vdocument.in/reader033/viewer/2022061110/545170e5af795902348b8a0f/html5/thumbnails/33.jpg)
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
![Page 34: In-Memory Data Grids Essentials. Oracle Coherence](https://reader033.vdocument.in/reader033/viewer/2022061110/545170e5af795902348b8a0f/html5/thumbnails/34.jpg)
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
![Page 35: In-Memory Data Grids Essentials. Oracle Coherence](https://reader033.vdocument.in/reader033/viewer/2022061110/545170e5af795902348b8a0f/html5/thumbnails/35.jpg)
Scalable eCommerce Platform SolutionsScalable eCommerce Platform Solutions
TipsUsing Oracle Coherence in practice
![Page 36: In-Memory Data Grids Essentials. Oracle Coherence](https://reader033.vdocument.in/reader033/viewer/2022061110/545170e5af795902348b8a0f/html5/thumbnails/36.jpg)
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?
![Page 37: In-Memory Data Grids Essentials. Oracle Coherence](https://reader033.vdocument.in/reader033/viewer/2022061110/545170e5af795902348b8a0f/html5/thumbnails/37.jpg)
Scalable eCommerce Platform Solutions
Memory usageLimit 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)
![Page 38: In-Memory Data Grids Essentials. Oracle Coherence](https://reader033.vdocument.in/reader033/viewer/2022061110/545170e5af795902348b8a0f/html5/thumbnails/38.jpg)
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
![Page 39: In-Memory Data Grids Essentials. Oracle Coherence](https://reader033.vdocument.in/reader033/viewer/2022061110/545170e5af795902348b8a0f/html5/thumbnails/39.jpg)
Scalable eCommerce Platform Solutions
Scalable eCommerce Platform Solutions
Thank you!Questions & Answers
![Page 40: In-Memory Data Grids Essentials. Oracle Coherence](https://reader033.vdocument.in/reader033/viewer/2022061110/545170e5af795902348b8a0f/html5/thumbnails/40.jpg)
Scalable eCommerce Platform Solutions
References• Workshop
– https://github.com/mmyslyvtsev/imdg-workshop• Coherence Knowledge Base
– http://coherence.oracle.com• Developers Guide
– http://docs.oracle.com/cd/E18686_01/coh.37/e18677/toc.htm• Book
– http://www.amazon.com/Oracle-Coherence-3-5-Aleksandar-Seovic/dp/1847196128