Download presentation
Presentation is loading. Please wait.
Published byMarybeth Cornelia Little Modified over 6 years ago
2
An Engineer’s Introduction to Oracle Coherence
Brian Oliver Senior Principal Solutions Architect | Oracle
3
Agenda What is Coherence? Demonstration Consensus How it works
Code Examples Architectural Patterns (c) Copyright Oracle Corporation
4
What is Coherence? (c) Copyright 2007. Oracle Corporation
5
Oracle Coherence Development Toolkit Other Libraries for…
Pure Java Libraries Pure .Net 1.1 and 2.0 (Client Libraries) No Third-Party Dependencies No Open Source Dependencies Other Libraries for… Database and File System Integration Top Link and Hibernate Http Session Management, Spring, …
6
Oracle Coherence Provides… Container-less Clustering of Java Processes
Data Structures to manage Data across a Cluster / Grid Real-Time Event Observation – Listener Pattern Materialized Views of Data Parallel Queries and Aggregation – Object-based Queries Parallel Data Processing Parallel Grid Processing RemoteException Free Distributed Computing Clustered JMX MAN + WAN Connectivity Client + Data Grid Deployment Models
7
Oracle Coherence Some uses…
Application Clustering and Reliable Data Sharing Caching state in the Application-tier Relieve load on lower-tier systems Databases, Mainframes, Web Servers, Web Services Scaling out application state (in the application-tier) In-Memory Http Session Management Resilient Processing Engine Temporary System of Record for Extreme Transaction Processing
8
Coherence Demonstration
(c) Copyright Oracle Corporation (c) Copyright Oracle Corporation
9
How Coherence Works (c) Copyright 2007. Oracle Corporation
10
Distributed Data Management (access)
The Partitioned Topology (one of many) In-Process Data Management (c) Copyright Oracle Corporation
11
Distributed Data Management (update)
(c) Copyright Oracle Corporation
12
Distributed Data Management (failover)
(c) Copyright Oracle Corporation (c) Copyright Oracle Corporation
13
Distributed Data Management
Members have logical access to all Entries At most 2 network operations for Access At most 4 network operations for Update Regardless of Cluster Size Deterministic access and update behaviour (performance can be improved with local caching) Predictable Scalability Cache Capacity Increases with Cluster Size Coherence Load-Balances Partitions across Cluster Point-to-Point Communication (peer to peer) No multicast required (sometimes not allowed) (c) Copyright Oracle Corporation
14
Data Distribution: Clients and Servers
“Clients” with storage disabled “Servers” with storage enabled (c) Copyright Oracle Corporation
15
Near Caching (L1 + L2) Topology
(c) Copyright Oracle Corporation
16
Observing Data Changes
(c) Copyright Oracle Corporation
17
Parallel Queries (c) Copyright Oracle Corporation
18
Parallel Processing and Aggregation
(c) Copyright Oracle Corporation
19
Data Source Integration (read-through)
(c) Copyright Oracle Corporation
20
Data Source Integration (write-through)
(c) Copyright Oracle Corporation
21
Data Source Integration (write-behind)
(c) Copyright Oracle Corporation
22
Coherence Code Examples
(c) Copyright Oracle Corporation (c) Copyright Oracle Corporation
23
Clustering Java Processes
Cluster cluster = CacheFactory.ensureCluster(); Joins an existing cluster or forms a new cluster Time “to join” configurable cluster contains information about the Cluster Cluster Name Members Locations Processes No “master” servers No “server registries” (c) Copyright Oracle Corporation
24
Leaving a Cluster Leaves the current cluster
CacheFactory.shutdown(); Leaves the current cluster shutdown blocks until “data” is safe Failing to call shutdown results in Coherence having to detect process death/exit and recover information from another process. Death detection and recovery is automatic (c) Copyright Oracle Corporation
25
Using a Cache get, put, size & remove
NamedCache nc = CacheFactory.getCache(“mine”); Object previous = nc.put(“key”, “hello world”); Object current = nc.get(“key”); int size = nc.size(); Object value = nc.remove(“key”); CacheFactory resolves cache names (ie: “mine”) to configured NamedCaches NamedCache provides data topology agnostic access to information NamedCache interfaces implement several interfaces; java.util.Map, Jcache, ObservableMap*, ConcurrentMap*, QueryMap*, InvocableMap* Coherence* Extensions (c) Copyright Oracle Corporation
26
Using a Cache keySet, entrySet, containsKey
NamedCache nc = CacheFactory.getCache(“mine”); Set keys = nc.keySet(); Set entries = nc.entrySet(); boolean exists = nc.containsKey(“key”); Using a NamedCache is like using a java.util.Map What is the difference between a Map and a Cache data-structure? Both use (key,value) pairs for entries Map entries don’t expire Cache entries may expire Maps are typically limited by heap space Caches are typically size limited (by number of entries or memory) Map content is typically in-process (on heap) (c) Copyright Oracle Corporation
27
Observing Cache Changes ObservableMap
NamedCache nc = CacheFactory.getCache(“stocks”); nc.addMapListener(new MapListener() { public void onInsert(MapEvent mapEvent) { } public void onUpdate(MapEvent mapEvent) { public void onDelete(MapEvent mapEvent) { }); Observe changes in real-time as they occur in a NamedCache Options exist to optimize events by using Filters, (including pre and post condition checking) and reducing on-the-wire payload (Lite Events) Several MapListeners are provided out-of-the-box. Abstract, Multiplexing... (c) Copyright Oracle Corporation
28
Querying Caches QueryMap
NamedCache nc = CacheFactory.getCache(“people”); Set keys = nc.keySet( new LikeFilter(“getLastName”, “%Stone%”)); Set entries = nc.entrySet( new EqualsFilter(“getAge”, 35)); Query NamedCache keys and entries across a cluster (Data Grid) in parallel* using Filters Results may be ordered using natural ordering or custom comparators Filters provide support almost all SQL constructs Query using non-relational data representations and models Create your own Filters * Requires Enterprise Edition or above (c) Copyright Oracle Corporation
29
Continuous Observation Continuous Query Caches
NamedCache nc = CacheFactory.getCache(“stocks”); NamedCache expensiveItems = new ContinuousQueryCache(nc, new GreaterThan(“getPrice”, 1000)); ContinuousQueryCache provides real-time and in-process copy of filtered cached data Use standard or your own custom Filters to limit view Access to “view”of cached information is instant May use with MapListeners to support rendering real-time local views (aka: Think Client) of Data Grid information. (c) Copyright Oracle Corporation
30
Aggregating Information InvocableMap
NamedCache nc = CacheFactory.getCache(“stocks”); Double total = (Double)nc.aggregate( AlwaysFilter.INSTANCE, new DoubleSum(“getQuantity”)); Set symbols = (Set)nc.aggregate( new EqualsFilter(“getOwner”, “Larry”), new DistinctValue(“getSymbol”)); Aggregate values in a NamedCache across a cluster (Data Grid) in parallel* using Filters Aggregation constructs include; Distinct, Sum, Min, Max, Average, Having, Group By Aggregate using non-relational data models Create your own aggregators * Requires Enterprise Edition or above (c) Copyright Oracle Corporation
31
Mutating Information InvocableMap
NamedCache nc = CacheFactory.getCache(“stocks”); nc.invokeAll( new EqualsFilter(“getSymbol”, “ORCL”), new StockSplitProcessor()); ... class StockSplitProcessor extends AbstractProcessor { Object process(Entry entry) { Stock stock = (Stock)entry.getValue(); stock.quantity *= 2; entry.setValue(stock); return null; } } Invoke EntryProcessors on zero or more entries in a NamedCache across a cluster (Data Grid) in parallel* (using Filters) to perform operations Execution occurs where the entries are managed in the cluster, not in the thread calling invoke This permits Data + Processing Affinity * Requires Enterprise Edition or above (c) Copyright Oracle Corporation
32
Oracle Coherence Architectural Patterns
(c) Copyright Oracle Corporation (c) Copyright Oracle Corporation
33
Single Application Process
Coherence as “Data Structure”. Single applications may use Coherence java.util.Map interface implementations (and extensions) for high-performance, highly configurable caching. Clustering is not required! (c) Copyright Oracle Corporation
34
Clustered Processes Coherence ensures that there is a consistent view of the data in-memory to all processes. This is sometimes referred to as a “single-system-image” (c) Copyright Oracle Corporation
35
Multi Platform Cluster
(c) Copyright Oracle Corporation
36
Clustered Application Servers
(c) Copyright Oracle Corporation
37
With Data Source Integration (Cache Stores)
(c) Copyright Oracle Corporation
38
Clustered Second Level Cache (for Hibernate)
(c) Copyright Oracle Corporation
39
Remote Clients connected to Coherence Cluster
(c) Copyright Oracle Corporation
40
Interconnected WAN Clusters
(c) Copyright Oracle Corporation
41
Getting Oracle Coherence
(c) Copyright Oracle Corporation (c) Copyright Oracle Corporation
42
Oracle Coherence Search: Download Support Read More
Download Support Read More Coherence Search For:
43
Questions (c) Copyright Oracle Corporation
44
Appendix
45
The preceding is intended to outline our general product direction
The preceding is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.