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.
3. Agenda
• Oracle High Performance Computing
• Oracle Coherence Architecture
• Gaming Industry Challenges
• Summary
4. Oracle High Performance Computing
Comprehensive 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
5. Oracle High Performance Computing
Comprehensive and Best of Breed
Management WebCache WebLogic Server Tuxedo
Tools
Content Cache J2EE and Messaging
Low Latency
Monitoring
Coherence Data Grid Complex Event TPM
Processing
SLA’s Low Latency
and Mature
Scalable Low Latency
QoS and
Resilient EQL Proven
Diagnostics JRockit Real-Time JVM
Real-
Fast Low Latency Predictable
Provisioning TimesTen
Berkeley DB
In-Memory Low Latency SQL
XML
Oracle RAC Embedded
Commodity Hardware Scale Out Transactional
6. Oracle Coherence
Data 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
7. 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”.
9. 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
10. 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)
11. 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.
12. 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.
16. 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
20. 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);
22. 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
23. 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);
24. 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.
27. 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
28. Serialization
Portable Object Format (POF)
• Benefits
• Can store more data
• Can read/write and move data faster
5x Smaller 10x Faster De-Serialization
Coherence Serialization Test Results
Coherence Compression Test Results
12000
10078
1000
900 867
10000
800
8000
700
600
Time (ms) 6000
Bytes
500
400 4000
309 322 1625 2070
300 2360
1234
186 2000
200
484
100 0 734 De-serialization
547
0 Serialization Java
Serialization
Java ExternalizationLite XMLBean POF De-serialization ExternalizationLite
XMLBean
Se rialization M echanisum POF
29. Coherence Incubator
Patterns
• Pre-built examples
• Used in production
systems
• Thoroughly tested
• Extensible
• Optimised
• Incorporate best
practice
30. 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
31. 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
32. 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
33. 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
34. Summary
• Coherence™ is the leading product for high <Insert Picture Here>
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