TopLink Grid: Scaling JPA applications with Coherence

Similar documents
1 Markus Eisele, Insurance - Strategic IT-Architecture

Coherence An Introduction. Shaun Smith Principal Product Manager

<Insert Picture Here> Oracle Application Cache Solution: Coherence

1 Copyright 2011, Oracle and/or its affiliates. All rights reserved.

Introducing EclipseLink: The Eclipse Persistence Services Project

High Performance Persistence with EclipseLink

ECLIPSE PERSISTENCE PLATFORM (ECLIPSELINK) FAQ

<Insert Picture Here>

Polyglot Persistence. EclipseLink JPA for NoSQL, Relational, and Beyond. Shaun Smith Gunnar Wagenknecht

Coherence & WebLogic Server integration with Coherence (Active Cache)

Advanced HTTP session management with Oracle Coherence

Integrating Oracle Coherence 12c (12.2.1)

Efficient Object-Relational Mapping for JAVA and J2EE Applications or the impact of J2EE on RDB. Marc Stampfli Oracle Software (Switzerland) Ltd.

Copyright 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

<Insert Picture Here> Getting Coherence: Introduction to Data Grids Jfokus Conference, 28 January 2009

Understanding Impact of J2EE Applications On Relational Databases. Dennis Leung, VP Development Oracle9iAS TopLink Oracle Corporation

ORACLE DATA SHEET KEY FEATURES AND BENEFITS ORACLE WEBLOGIC SUITE

The Evolution of Java Persistence

Oracle Fusion Middleware

foreword to the first edition preface xxi acknowledgments xxiii about this book xxv about the cover illustration

TOPLink for WebLogic. Whitepaper. The Challenge: The Solution:

Pimp My Data Grid. Brian Oliver Senior Principal Solutions Architect <Insert Picture Here>

XTP, Scalability and Data Grids An Introduction to Coherence

Web Application Development Using JEE, Enterprise JavaBeans and JPA

CO Java EE 6: Develop Database Applications with JPA

Fast Track to EJB 3.0 and the JPA Using JBoss

<Insert Picture Here> Oracle Cloud Strategy: Oracle s Vision for Next- Generation Application Grid, Virtualization and Cloud

Web Application Development Using JEE, Enterprise JavaBeans and JPA

Building Java Persistence API Applications with Dali 1.0 Shaun Smith

JPA The New Enterprise Persistence Standard

Eclipse Persistence Services The Full Monty

Teneo: Integrating EMF & EclipseLink

Java EE Architecture, Part Three. Java EE architecture, part three 1(69)

Infinispan for Ninja Developers

<Insert Picture Here> A Brief Introduction to Live Object Pattern

Developing Applications with Java EE 6 on WebLogic Server 12c

"Web Age Speaks!" Webinar Series

object/relational persistence What is persistence? 5

Java EE Architecture, Part Three. Java EE architecture, part three 1(57)

EclipseLink. Solutions Guide for EclipseLink Release 2.6. June Beta Draft

ORACLE WEBLOGIC SERVER

Object-relational mapping tools and Hibernate

Creating Ultra-fast Realtime Apps and Microservices with Java. Markus Kett, CEO Jetstream Technologies

Java EE 7: Back-End Server Application Development

An Oracle White Paper July Oracle WebLogic Suite 12c (12.1.2) Technical White Paper

Roadmap to Cloud with Cloud Application Foundation

find() method, 178 forclass() method, 162 getcurrentsession(), 16 getexecutablecriteria() method, 162 get() method, 17, 177 getreference() method, 178

1 Dulcian, Inc., 2001 All rights reserved. Oracle9i Data Warehouse Review. Agenda

Java Enterprise Edition

Enterprise Java Development using JPA, Hibernate and Spring. Srini Penchikala Detroit JUG Developer Day Conference November 14, 2009

Javaentwicklung in der Oracle Cloud

DATA ACCESS TECHNOLOGIES FOR JAVA GENERAL STUDY

Inside GigaSpaces XAP Technical Overview and Value Proposition

5/2/2017. The entity manager. The entity manager. Entities lifecycle and manipulation

Java EE Architecture, Part Three. Java EE architecture, part three 1(24)

Java- EE Web Application Development with Enterprise JavaBeans and Web Services

JVA-563. Developing RESTful Services in Java

Oracle Application Development Framework Overview

<Insert Picture Here> Oracle Coherence & Extreme Transaction Processing (XTP)

Oracle Database Mobile Server, Version 12.2

CO Java EE 7: Back-End Server Application Development

Table of Contents. I. Pre-Requisites A. Audience B. Pre-Requisites. II. Introduction A. The Problem B. Overview C. History

White Paper. Major Performance Tuning Considerations for Weblogic Server

Web Application Development Using Spring, Hibernate and JPA

Enterprise Architectures

Oracle Corporation

WLS Neue Optionen braucht das Land

About Terracotta Ehcache. Version 10.1

JVA-163. Enterprise JavaBeans

Prices in Japan (Yen) Oracle Technology Global Price List December 8, 2017

Data Modeling and Databases Ch 14: Data Replication. Gustavo Alonso, Ce Zhang Systems Group Department of Computer Science ETH Zürich

<Insert Picture Here> Future<JavaEE>

Monday, November 21, 2011

Web Application Development Using Spring, Hibernate and JPA

<Insert Picture Here> MySQL Cluster What are we working on

Web Application Development Using Spring, Hibernate and JPA

Supports 1-1, 1-many, and many to many relationships between objects

WebLogic & Oracle RAC Active GridLink for RAC

"Charting the Course... Mastering EJB 3.0 Applications. Course Summary

Seam 3. Pete Muir JBoss, a Division of Red Hat

WebSphere extreme Scale

Leverage Rational Application Developer v8 to develop Java EE6 application and test with WebSphere Application Server v8

Scott Meder Senior Regional Sales Manager

Oracle Coherence 3.6: Share and Manage Data in Clusters

Spring Framework 2.0 New Persistence Features. Thomas Risberg

Oracle Exadata: Strategy and Roadmap

J2EE Access of Relational Data

MySQL Group Replication. Bogdan Kecman MySQL Principal Technical Engineer

The Definitive Guide to. NetBeans Platform 7. Heiko Bock. Apress*

Shale and the Java Persistence Architecture. Craig McClanahan Gary Van Matre. ApacheCon US 2006 Austin, TX

purequery Deep Dive Part 2: Data Access Development Dan Galvin Galvin Consulting, Inc.

Lightweight J2EE Framework

Craig Blitz Oracle Coherence Product Management

<Insert Picture Here> Value of TimesTen Oracle TimesTen Product Overview

Object Persistence Design Guidelines

Database Management Systems

Introduction to JPA. Fabio Falcinelli

Postgres Plus and JBoss

status Emmanuel Cecchet

Lightweight J2EE Framework

Transcription:

<Insert Picture Here> TopLink Grid: Scaling JPA applications with Coherence Shaun Smith Principal Product Manager shaun.smith@oracle.com

Java Persistence: The Problem Space Customer id: int name: String creditrating: int Java JPA JAXB/SDO XR (XML- Relational) <customer id= > <name> </name> </contact-info> </customer> XML CUST ID NAME C_RATING Relational JPA: Java Persistence API JAXB: Java Architecture for XML Binding SDO: Service Data Objects

EclipseLink Project JPA 2.0 Reference Implementation (JSR 317) Provides JPA, JAXB, SDO, DBWS, and EIS persistence services Open source Eclipse project Founded by Oracle with the contribution of full Oracle TopLink source code and tests Based upon product with 12+ years of commercial usage

EclipseLink: Distributions Eclipse.org www.eclipse.org/eclipselink/downloads Eclipse P2 & Maven repositories Oracle TopLink 11g WebLogic Server 10.3 GlassFish v3 Replaces TopLink Essentials JPA 2.0 Reference Implementation Spring Source: Framework & Bundle Repo JOnAS Application Server 5.1 JEUS TmaxSoft

EclipseLink JPA Supports Java EE, Java SE, Web, Spring, and OSGi Supports all leading RDMS with platform specific features Best JPA for the Oracle Database supporting advanced features Extensible and pluggable Key infrastructure: Caching, Locking, Query Framework, Mapping, plus many valuable advanced features

JPA Performance Mapping Querying Optimized Graph Loading: Join and Batch Projections, Streaming, Range Stored Procedures/Functions Transactions Minimal, Ordered, and Deferred Changes Sequence pre-allocation Caching Cache reusable data and leverage in future operations

Advanced Performance Features Minimal Writes, Updates Batch Reading, Writing SQL ordering Transformation support Existence checks Stored procedures Statement Caching Scrolling cursors Projection Queries Fetch Groups Just in Time reading Automatic change detection Caching policies and sizes Parameterized SQL (binding) Pre-allocation of sequence numbers Cache Coordination Optimistic, Pessimistic locking Joining object retrieval optimization In memory querying Dynamic queries AND MUCH MORE

Example JPA Client Code

Mechanics of a JPA Application Step 1 Application Logic Step 2 Application Logic Step 3 Application Logic Create/ Modify Entities JPA Read Entities JPA JPA Insert/ Update Entities

JPA with Cache TX n Application Logic TX n+1 Application Logic JPA Read TX Commit Entities Cache hits avoid object build cost

Application Application Application Application Application Application Application Application Application Application Application Application Application Application Application Scaling Java Persistence JPA JPA... JPA

EclipseLink in a Cluster Application Logic Application Logic EntityManager Persistence Context EntityManager Persistence Context EntityManagerFactory Shared Cache Need to keep Shared Caches Coherent EntityManagerFactory Shared Cache

Traditional Approaches to Scaling JPA Historically there have been two strategies for scaling EclipseLink JPA applications into a cluster: Disable Shared Caching No shared cache Always Refresh Cache Coordination Communicate changes via messaging

Strategy 1: Disable Shared Cache Application Logic Application Logic EntityManager Persistence Context EntityManager Persistence Context EntityManagerFactory EntityManagerFactory

Disable Shared Cache Ensures all nodes have coherent view of data. Database is always right Each transaction queries all required data from database and constructs Entities No inter-node messaging Memory footprint of application increases as each transaction has a copy of each required Entity Every transaction pays object construction cost for queried Entities. Database becomes bottleneck

Strategy 2: Cache Coordination Application Logic Application Logic EntityManager Persistence Context EntityManager Persistence Context EntityManagerFactory Shared Cache Cache Coordination EntityManagerFactory Shared Cache

Cache Coordination Minimize stale entity caching across loosely coupled nodes. Database is always right Optimistic locking prevents corruption Fresh Entities retrieved from shared cache Stale Entities refreshed from database on access Creation and/or modification of Entity results in message to all other nodes Shared cache size limited by heap of each node Cost of coordinating depends on messaging technology and application cost of communication and processing may eventually exceed value of caching

Extending EclipseLink s Cache EclipseLink provides out of box support for Object caching: Shared, Isolated, Transactional Cache Coordination EclipseLink s Caching and Querying extension points Cache Interceptors Query Redirectors EclipseLink can be extended to support 3 rd party grid caching solutions

Introducing TopLink Grid TopLink Grid allows Java developers to transparently leverage the power of the Coherence data grid TopLink Grid combines: the simplicity of application development using the Java standard Java Persistence API (JPA) with the scalability and distributed processing power of Oracle s Coherence Data Grid. Supports 'JPA on the Grid' Architecture EclipseLink JPA applications using Coherence as a shared (L2) cache replacement along with configuration for more advanced usage

Oracle TopLink 11gR1 Oracle s Enterprise Java Persistence Framework Includes open source EclipseLink with Commercial Support Certified on WebLogic and redistributed by Oracle as part of TopLink product and in WebLogic Server and Oracle GlassFish TopLink Grid: JPA integration with Coherence Tooling Support in JDeveloper and Eclipse

TopLink Grid with Coherence Cache Application Logic Application Logic EntityManager Persistence Context EntityManager Persistence Context EntityManagerFactory EntityManagerFactory Coherence

Oracle Coherence Data Grid Distributed in Memory Data Management Enterprise Applications Databases Real Time Web Clients Services Data Services Oracle Coherence Data Grid Mainframes Web Services Provides a reliable data tier with a single, consistent view of data Enables dynamic data capacity including fault tolerance and load balancing Ensures that data capacity scales with processing capacity

Coherence Topology Example Distributed Topology Data spread and backed up across Members Transparent to developer Members have access to all Data All Data locations are known no lookup & no registry! 23

Coherence Update Example Distributed Topology Synchronous Update Avoids potential Data Loss & Corruption Predictable Performance Backup Partitions are partitioned away from Primaries for resilience No engineering requirement to setup Primaries or Backups Automatically and Dynamically Managed 24

Coherence Recovery Example Distributed Topology No in-flight operations lost Some latencies (due to higher priority of recovery) Reliability, Availability, Scalability, Performance are the priority Degrade performance of some requests 25

JPA with Coherence Cluster Node 1 Application Logic Cluster Node N Application Logic... JPA JPA Coherence Read TX Commit Entities

TopLink Grid Configurations Grid Cache Coherence as Shared (L2) Cache Configurable per Entity type Entities read by one grid member are put into Coherence and are immediately available across the entire grid Grid Read All supported read queries executed in the Coherence data grid All writes performed directly on the database by TopLink (synchronously) and Coherence updated Grid Entity All supported read queries and all writes are executed in the Coherence data grid

Grid Cache ('Cache Aside') Reading: Primary Key queries check Coherence first. If found in Coherence, Entity is returned. If not found the database is queried. Entities queried from database are put() into Coherence and returned to the application. Writing: All inserts, updates, and deletes are directed to the database On successful commit, Coherence is updated JPA Application Insert/ Update/ Delete Query PK Query

Grid Cache Leveraging Cache Cache is used when processing database results EclipseLink extracts primary keys from results and checks cache to avoid object construction. Even if a SQL query is executed, an object cache can still improve application throughput by eliminating object construction costs for cached Entities

Grid Read All writes performed directly on database. Primary key queries result in get() on Coherence JPQL queries, e.g., Select e from Employee E are translated to Filters and executed in Coherence CacheLoaders should be configured to query database with PK query on cache miss JPA Application Insert/ Update/ Delete Query PK Query

Grid Entity Reading Primary key queries result in get() on Coherence JPQL queries, e.g., Select e from Employee E are translated to Filters and executed in Coherence The database is not queried by EclipseLink. JPA Application Query CacheLoaders may be configured to query database with PK query on cache miss PK Query

Grid Entity Writing Applications commit JPA transactions with new, deleted, or modified Entities EclipseLink put()s all new and updated Entities into Coherence and remove()s deleted Entities. CacheStores may be configured to write cache changes to the database using TopLink Grid JPA Application Insert/ Update/ Delete Put/ Remove

Grid Enabling JPA Entities A single annotation is added to an Entity to enable Coherence usage, e.g., @Entity @Customizer(GridCacheCustomizer.class) public class Employee implements Serializable { } Standard Coherence cache configuration applies POF (Portable Object Format), ExternalizableLite, and Serializable Entities supported

Demo Application Logic EntityManager Persistence Context EntityManagerFactory TopLink Grid Coherence

Demo Application Logic EntityManager Persistence Context EntityManagerFactory TopLink Grid Coherence Coherence

TopLink Grid Relationship Support TopLink Grid 11gR1 supports torage of complex graphs of Entities with each Entity type stored in a corresponding cache. Relationship information is stored into Coherence and reconstituted upon retrieval Can query for objects of class A, B, or C Lazy and eager relationships are supported even to db data! JPA Application B A C Multiple Object Graph a: [010111010] b: [110011010] c: [101011010]

Caching Objects, not Data EclipseLink's shared cache is an object cache Cache hits do not incur object construction costs typically a significant part of object/relational mapping Coherence caches serialized objects Using Coherence as EclipseLink's shared object cache Only incurs serialization cost, not object construction Can leverage POF serialization for maximum performance TopLink Grid pays the object construction cost only once and eliminates it for each cluster member

How is TopLink Grid different from Hibernate with Coherence? Hibernate does not cache objects, it caches data rows in Coherence Using Coherence as a cache for Hibernate Every cache hit incurs both object construction and serialization costs Worse, object construction cost is paid by every cluster member for every cache hit Hibernate only uses Coherence as a cache TopLink Grid is unique in supporting execution of queries against Coherence which can significantly offload the database and increase throughput

Summary EclipseLink supports a unique range of strategies for scaling JPA applications TopLink Grid provides: An easy way for JPA developers to scale out their Java EE applications 'JPA on the Grid' functionality to support scaling JPA applications with Coherence Support for caching Entities with relationships in Coherence