JPA Performance Myths -- JavaOne 2013

13
© 2013 IBM Corporation Rick Curtis – Staff Software Engineer 29 September 2013 JPA Performance Myths Session ID : BOF4454

description

Every few months, another Joe (or Jane) Shmoe decides it’s time to write an agenda-driven blog post (or presentation for a conference) that shows why a particular flavor of JPA blows all the other competitors out of the water. This session shows that, when properly used/tuned, the JPA implementations from the major providers (EclipseLink, Hibernate, and OpenJPA) all perform nearly the same.

Transcript of JPA Performance Myths -- JavaOne 2013

Page 1: JPA Performance Myths -- JavaOne 2013

© 2013 IBM Corporation

Rick Curtis – Staff Software Engineer

29 September 2013

JPA Performance Myths Session ID : BOF4454

Page 2: JPA Performance Myths -- JavaOne 2013

© 2013 IBM Corporation

Important Disclaimers

THE INFORMATION CONTAINED IN THIS PRESENTATION IS PROVIDED FOR INFORMATIONAL PURPOSES ONLY.

WHILST EFFORTS WERE MADE TO VERIFY THE COMPLETENESS AND ACCURACY OF THE INFORMATION CONTAINED IN THIS PRESENTATION, IT IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED.

ALL PERFORMANCE DATA INCLUDED IN THIS PRESENTATION HAVE BEEN GATHERED IN A CONTROLLED ENVIRONMENT. YOUR OWN TEST RESULTS MAY VARY BASED ON HARDWARE, SOFTWARE OR INFRASTRUCTURE DIFFERENCES.

ALL DATA INCLUDED IN THIS PRESENTATION ARE MEANT TO BE USED ONLY AS A GUIDE.

IN ADDITION, THE INFORMATION CONTAINED IN THIS PRESENTATION IS BASED ON IBM’S CURRENT PRODUCT PLANS AND STRATEGY, WHICH ARE SUBJECT TO CHANGE BY IBM, WITHOUT NOTICE.

IBM AND ITS AFFILIATED COMPANIES SHALL NOT BE RESPONSIBLE FOR ANY DAMAGES ARISING OUT OF THE USE OF, OR OTHERWISE RELATED TO, THIS PRESENTATION OR ANY OTHER DOCUMENTATION.

NOTHING CONTAINED IN THIS PRESENTATION IS INTENDED TO, OR SHALL HAVE THE EFFECT OF:

- CREATING ANY WARRANT OR REPRESENTATION FROM IBM, ITS AFFILIATED COMPANIES OR ITS OR THEIR SUPPLIERS AND/OR LICENSORS

2

Page 3: JPA Performance Myths -- JavaOne 2013

© 2013 IBM Corporation

Introduction to the speaker – Rick Curtis

Have been working in the industry for over 7 years

Committer and PMC member for the Apache OpenJPA project.

Heavily focused on performance of JPA when running inside of WebSphere Application Server.

Contact info : [email protected]

Visit the IBM booth #5112 and meet other IBM developers at JavaOne 2013

3

Page 4: JPA Performance Myths -- JavaOne 2013

© 2013 IBM Corporation

Agenda

4

Evangelism

The crux

Who wants to go fast?

Getting dirty

Outliers

TL;DL

Questions

Page 5: JPA Performance Myths -- JavaOne 2013

© 2013 IBM Corporation

Evangelism

5

Fastest JPA implementation on [the face of the Earth | ever | etc]!

Is 10x faster than other JPA solutions

Provider [x] is much [faster, scalable, etc, etc] than [y]

Anything that is claiming a new world record

General fanboy presentations

Always view these with some amount of skepticism.

Page 6: JPA Performance Myths -- JavaOne 2013

© 2013 IBM Corporation

The crux

6

Lots of configuration options

Different default values

Spec compliant, yet differences in behavior

Page 7: JPA Performance Myths -- JavaOne 2013

© 2013 IBM Corporation

Who wants to go fast?

7

Depending on the provider, configure weaving

Pooling– EntityManagers, EntityManagerFactories, connections

Caching– Data cache, object cache, ReadOnly cache, query cache, sql cache, caching

connections

Proper mapping / JPA usage– Developers must have some relational database knowledge– Only load the required data– Minimize database trips– Entity Graph API

Page 8: JPA Performance Myths -- JavaOne 2013

© 2013 IBM Corporation

Getting dirty

8

Understand your application inside and out

Use an SQL profiling tool to gather every SQL statement that comes from your application, and understand where each one comes from.

– OpenJPA SQL Profiler– EclipseLink Profiler– Numerous commercial Hibernate tools– jdbcGrabber – google code

Page 9: JPA Performance Myths -- JavaOne 2013

© 2013 IBM Corporation

Getting dirty

9

Understand your application inside and out

Use an SQL profiling tool to gather every SQL statement that comes from your application, and understand where each one comes from.

Page 10: JPA Performance Myths -- JavaOne 2013

© 2013 IBM Corporation

Getting dirty

10

Understand your application inside and out

Use an SQL profiling tool to gather every SQL statement that comes from your application, and understand where each one comes from.

– OpenJPA SQL Profiler– EclipseLink Profiler– Reference Hibernate tool– jdbcGrabber -- google

Once you are able to identify where every query comes from, then you can start to figure out where caching makes the most sense.

Break an application down into small use cases to try to optimize

Page 11: JPA Performance Myths -- JavaOne 2013

© 2013 IBM Corporation

TL;DL

11

A benchmark is a benchmark and unless your application is a benchmark, your mileage may vary

Thorough understand of an application will go many more miles than switching JPA providers.

Enabling intelligent caching in your application will show the most dramatic performance improvements

Think of the database as your enemy, you don’t want to talk to him unless you must.

If performance is your #1, #2, and #3 concern, use JDBC.

Page 12: JPA Performance Myths -- JavaOne 2013

© 2013 IBM Corporation

Help wanted

12

JPA 2.1 Roadmap -- http://openjpa.apache.org/jpa-2.1-roadmap.html

JPA 2.1 Tasks -- http://openjpa.apache.org/jpa-2.1-tasks.html

Page 13: JPA Performance Myths -- JavaOne 2013

© 2013 IBM Corporation

Questions ?

13

http://ibm.co/JavaOne2013