Upload
gojkoadzic
View
1.860
Download
0
Tags:
Embed Size (px)
DESCRIPTION
From the Gaming Scalability event, June 2009 in London (http://gamingscalability.org). Dave Felcey from Oracle will give an overview of Oracle Coherence and releted technologies, like JRockit Real-Time JVM, and discuss how they are being used to address some of the challenges their gaming customers face. In the gaming industry real-time updates and resilience are key. Getting price changes to users by caching data in memory and pushing real-time changes to clients using Coherence can provides a competitive edge and attracts new customers. Increasingly holding data in-memory and using the real-time tools are the only way sites can meet user expectations. However, ensuring in-memory data is resilient under load is also crucial, to protect against costly outages at key times. Dave will discuss the technical details and approaches that can be used to meet these requirements.
Citation preview
<Insert Picture Here>
Betting on Data Grids
Dave Felcey
Oracle Sales Consulting
Agenda
• Oracle High Performance Computing
• Oracle Coherence Architecture
• Gaming Industry Challenges
• Summary
Oracle High Performance ComputingComprehensive and Best of Breed
• Oracle 11g WebLogic Server• Fastest Applicaton Server, delivering 7,311 SPECjAppServer2004
JOPS@Standard (jAppServer Operations per Second)
• Oracle JRockit Real-Time JVM• Fastest JVM, delivering 537,116 SPECjbb2005 bops/JVM p/s
• Oracle Complex Event Processing• Fraud detection, risk mitigation etc.
• Oracle 11g Database• Used by Betfair for performance and scalability and one of top 5
busiest databases in the world
• Oracle TimesTen In-Memeory Database• The Hong Kong Jockey Club uses TimesTen to perform very fast
fraud detection processing
• Oracle Identity Management (IdM)• Used by Shanda to manage ID of upto 2M concurrent users
Oracle High Performance ComputingComprehensive and Best of Breed
Low Latency Predictable
JRockitJRockit RealReal--Time JVMTime JVM
Low Latency
Scalable
Resilient
Coherence Data GridCoherence Data Grid
Low Latency
Complex Event Complex Event ProcessingProcessing
Content Cache J2EE and Messaging
WebCacheWebCache WebLogicWebLogic ServerServer
Monitoring
Management Management ToolsTools
Scale OutCommodity Hardware
Oracle RACOracle RAC
SLA’sand QoS
Diagnostics
Provisioning
EQL
XML
Embedded
Transactional
Berkeley DBBerkeley DB
Fast
Low Latency SQL
TimesTenTimesTen
In-Memory
TuxedoTuxedo
Low Latency
TPM
Mature and
Proven
Oracle CoherenceData Grid Uses
Caching
Applications request data from the Data Grid rather than
backend data sources
Analytics
Applications ask the Data Grid questions from simple queries to
advanced scenario modeling
Transactions
Data Grid acts as a transactional System of Record, hosting
data and business logic
Events
Automated processing based on event
The Coherence Approach…
• Consensus is key
• Communication is more efficient (peer-to-peer)
• No outages for voting (no need – everyone is a peer)
• No SPoF, SPoB
• No need for broadcast traffic (yelling at each other)
• You can do many things once you have “consensus”.
TCMP Provides the Foundations
What is Coherence?
• Coherence (deployment perspective)
• Single Library*
• *Other libraries for integration (L2C, Spring…)
• Configurable implementations of standard Map interfaces
(called NamedCache’s)
• Standard Java Archive “JAR” for Java
• Standard Dynamically Linked Library “DLL” for .NET
connectivity (.Net 1.1 and 2.0)
• Standard DLL or .so for C++ clients
• No 3rd party dependencies!
• Minimal “invasion” on standard code*
• “RemoteException” free distributed computing
Introduction to NamedCaches
• Developers use NamedCaches to manage data
• An composite interface which includes Map
• NamedCache
• Logically equivalent to a Database table
• Store related types of information (trades, orders, sessions)
• May be hundreds / thousands of per Application
• May be dynamically created
• May contain any data (no need to setup a schema)
• No restriction on types (homogeneous and heterogeneous)
• Not relational (but may be)
Clustered Hello World!
public void main(String[] args) throws IOException {
NamedCache nc = CacheFactory.getCache(“test”);
nc.put(“key”, “Hello World”);
System.out.println(nc.get(“key”));
System.in.read(); //may throw exception
}
• Joins / Establishes a cluster
• Places an Entry (key, value) into the Cache “test” (notice no
configuration)
• Retrieves the Entry from the Cache.
• Displays it.
• “read” at the end to keep the application (and Cluster) from
terminating.
Caching Strategies (schemes)Different cache implementations
• Local
• Local on-heap caching for non-clustered caching.
• Replicated
• Perfect for small, read-heavy caches.
• Partitioned
• True linear scalability for both read and write access. Data is automatically, dynamically and transparently partitioned across nodes. The distribution algorithm minimizes network traffic and avoids service pauses by incrementally shifting data.
• Near Cache
• Provides the performance of local caching with the scalability of distributed caching. Several different near-cache strategies provide varying tradeoffs between performance and synchronization guarantees.
The Distributed Scheme - Get
The Distributed Scheme - Put
The Distributed Scheme - Failover
The Near Scheme
• A composition of pluggable Front and Back schemes
• Provides L1 and L2 caching (cache of a cache)
• Why:
• Partitioned Topology may always go across the wire
• Need a local cache (L1) over the distributed scheme (L2)
• Best option for scalable performance!
• How:
• Configure ‘front’ and ‘back’ topologies
• Configurable Expiration Policies:
• LFU, LRU, Hybrid (LFU+LRU), Time-based, Never,
Pluggable
The Near Scheme - Get
Coherence*Extend
WAN Topology
Queries
• Filters applied in parallel (in the Grid)
• A large range of filters out-of-the-box:
All, Always, And, Any, Array, Between,
ContainsAll, ContainsAny, Contains, Equals,
GreaterEquals, Greater, In, InKeySet,
IsNotNull, IsNull, LessEquals, Less, Like,
Limit, Never, NotEquals, Not, Or…
Filter filter = new AndFilter(
new EqualsFilter("getTrader", traderId),
new EqualsFilter("getStatus", Status.OPEN));
Set setOpenTrades = mapTrades.entrySet(filter);
Executing a query
Real Time Events
• Maintain real time visibility into data changes
• Desktops
• The usual example is the “Trader desktop”
• Watch data change in near real time
• Typically a few milliseconds
• Servers
• Monitoring data to trigger additional processing
• Event Driven Architecture within the data grid
• Very wide-ranging set of use cases
• Not many common patterns of usage
Continuous Query Cache
Coherence implements Continuous Query using a combination
of its data fabric parallel query capability and its real-time event-
filtering and streaming. The result is support for thousands of
client application instances, such as trading desktops. Using the
previous trading system example, it can be converted to a
Continuous Query with only one a single line of code changed
NamedCache mapTrades = ...
Filter filter = new AndFilter(new
EqualsFilter("getTrader", traderid),
new EqualsFilter("getStatus", Status.OPEN));
NamedCache mapOpenTrades = new
ContinuousQueryCache(mapTrades, filter);
Transaction Management
• Explicit transaction management• Using the general pattern for pessimistic transactions is "lock
-> read -> write -> unlock". For optimistic transactions, the sequence is "read -> lock & validate -> write -> unlock".
• Implicit transaction management• Locking "by convention" – for example, requiring that all
acessors lock only the "parent" Order object. Doing this can reduce the scope of the lock from table-level to order-level, enabling far higher scalability
• Further transaction optimizations• Using EntryProcessors – sending the code to the data, so
that operations are queued and all locking is local. Operations must be idempotent.
Cache ThroughReading ahead or on-demand
Persisting DataWrite-through, write-behind, coalescing and batching
HTTP Session Caching
Overview
• No code changes required to use
• Portlet state can be cached
• Built into WLS and WLP
Benefits
• Enables stateless middle tier
• Better hardware utilization
• Simpler network infrastructure
• Facilitates modular application improvements
• Scales out middle tier
Serialization Portable Object Format (POF)
• Benefits
• Can store more data
• Can read/write and move data faster
Coherence Compression Test Results
867
309 322
186
0
100
200
300
400
500
600
700
800
900
1000
Java ExternalizationLite XMLBean POF
Byte
s
Java
ExternalizationLite
XMLBean
POF
Serialization
De-serialization
10078
1625 2070
12342360
484734
547
0
2000
4000
6000
8000
10000
12000
Time (ms)
Serialization Mechanisum
Coherence Serialization Test Results
Serialization
De-serialization
5x Smaller 10x Faster De-Serialization
Coherence IncubatorPatterns
• Pre-built examples
• Used in production systems
• Thoroughly tested
• Extensible
• Optimised
• Incorporate best practice
Gaming Challenges
• Extreme scalability 500k+ users
• Reliability. Outages damage reputation and can cost £100k+ p/hr
• Flexibility. Enable products to be quickly brought to
market
Extreme Scalability
• Scaling Users
• 100k – 1M online users
• Asynchronously update database so reduce latency, open
connections etc.
• Scaling Transactions and Processing
• Betfair
• INCERNO processed 5k TPS in simulation tests with no
discernable deterioration in performance or reliability.
• Scaling Data Capacity, >100 GB
• Off-heap storage option in release 3.5
• Potential storage limit now > TB
Extreme Reliability
• Non-Stop running
• 2 years+ continuous running
• Withstand database or link replication failure
• Queue requests
• Failure of multiple servers
• No ‘Single Point Of Failure’
• Processing (as well as data) failover
Extreme Flexibility
• Native Java, C++ and .NET clients
• Simple Map and IDictionary API
• Simple to install
• Pre-built examples (Incubator Projects)
• Seamless HTTP Session integration for J2EE and .NET
• Support of Hibernate, JPA and Spring
Support
• Active forums and SIG’s
• Well documented
<Insert Picture Here>
Summary
• Coherence™ is the leading product for high
performance distributed in-memory data services• Proven technology, 100+ customers and 1500+
production systems
• Offers a unique combination of features
• Coherence™ is easy to use and delivers
data performance, scalability and reliability