SlideShare ist ein Scribd-Unternehmen logo
1 von 51
© 2013 SpringOne 2GX. All rights reserved. Do not distribute without permission.
Performance-tuning the «Spring Pet Clinic»
sample application
By Julien Dubois
About me
• Julien Dubois
• From Paris, France
• Co-authored «Spring par la pratique» (French
book on Spring)
• Former SpringSource France director
• Director of Consulting at Ippon Technologies
• Follow me @juliendubois
2
Goals of this presentation
• Make a specific application run faster
• Learn classic issues with Spring Web
applications
• Learn our methodology to solve
performance issues
3
More information on this presentation
• This presentation started with a series of blog posts:
http://blog.ippon.fr/tag/spring-petclinic/
• You can run your own tests, every step is cleanly commited
on Github:
https://github.com/jdubois/spring-petclinic
4
What’s new since the blog entries?
• Java 7
• I got a brand new MacBook :-)
–Does a SSD really matters?
–Does the new core i7 matters?
5
6
Introducing
the Spring
Pet Clinic
sample
application
Do you remember the Sun Java Pet Store?
• Used to explain how you
could build an incredibly
complex application
• On a very expensive
application server
• With an horrible-looking
result
• When your customer only
wanted a simple Web app
7
The Spring Pet Clinic
• Is here to demonstrate Spring
features and best practices
• Is a very classical MVC-style
application (no REST + funky JS
library)
• Is still a good excuse to use cute
dogs in your presentation
8
More information on the Spring Pet Clinic
• Code:
https://github.com/SpringSource/spring-petclinic/
• Short presentation:
https://speakerdeck.com/michaelisvy/spring-petclinic-sample-
application
9
10
#1
Putting the
application
in
production
Moving to production
• Be as close as possible to a «production environment»
–Remove «debugging» logs [ Code ]
–Use a «real» database [ Code ]
• For this presentation our environment isn’t perfect
–Everything runs on the same machine
–Even the presentation itself :-)
11
Memory tuning
• We’re running the application from the Maven Tomcat plugin
–Of course Maven takes some resources
• Still the application runs with a small memory footprint
–export MAVEN_OPTS="-XX:MaxPermSize=64m -Xms128m -
Xmx128m"
• Why not use more memory?
–It’s easier to spot memory problems
–We don’t need it (we’re not using a big fat Java EE server!)
12
13
#2
Creating a
JMeter test
Simulate load
• JMeter will simulate users
–500 users
–In a «realistic» way
• Use a timer
• Check «clear cookies each iteration?»
14
Results
• 250 req/sec
• Lots of errors
• Quickly ends with a crash...
15
16
#3
Profiling
Does profiling distort results?
• Short answer : not a lot
–We’ll see this when the application runs better
• We have used JProfiler and VisualVM in production many
times
–Often caused less trouble than official «production monitoring
tools» like HP Diagnostics
–Only way to find problems and understand what’s going on
–Easy to install
17
Choose your weapon
• VisualVM
–Free & lightweight
–Included in the JDK
• JProfiler
–Best tool we’ve used
• YourKit
–Easy to use & cheap
18
First culprit : Dandelion
• More specifically, Dandelion module for
DataTables
–https://github.com/dandelion/dandelion-datatables
• Nice & fun JSP taglib for rendering JQuery
DataTables
–Has a memory leak in this version
–Is now corrected (extremely quick response time
from the Dandelion team)
• So we switched to «plain old JQuery
DataTables» [ Code ]
19
Second culprit : the HTTP Session
• Using HTTP Sessions can be helpful
–Developer productivity
–Data security
• Going stateless is often better
–Uses less RAM
–More scalable
20
Going stateless
• Example : the PetController.processUpdateForm() method
–Use Spring MVC REST to get more information from the URL
–Fetch again the missing data
• We said more scalability, not more performance (for the moment)
• With some work, the whole application can become stateless
[ Code ]
21
Results
• 500 req/sec
• A few errors
• That’s a lot better than before!
22
23
#4
Tomcat
tuning
Tomcat tuning
• This is the easiest step
–Migrate to the latest version of the Tomcat plugin
–Use the new NIO connector
• org.apache.coyote.http11.Http11NioProtocol
• [ Code ]
24
25
• 950 req/sec
• No errors
• Victory :-)
Results
26
#5
Removing
locks
Locks
• Locks are blocked threads
–Aka «there’s a synchronized somewhere»
• They obviously cause scalability problems
• Let’s launch our profiler again!
27
First culprit : commons DBCP
• Commons DBCP does a lot of synchronization
• We replaced it with Tomcat JDBC
–New JDBC pool for Tomcat, for highly concurrent systems
• But we have kept the pool size at 8
–So obviously we will still have locks
–Making it bigger hinders performance
• If the database was on a separate server, we would use a bigger number
• The database is always the problem
• [ Code ]
28
Second culprit : Webjars
• WebJars are client-side libraries (JQuery, etc...) packaged as Jar
files
–http://www.webjars.org/
–Those libraries are loaded from the classloader
• Which does a big lock each time it is accessed
• So if you have a lot of libraries this can be a real problem
• There are many solutions to this issue
–Cache those resources with a proxy server
–Use another solution for loading those libraries (Bower ?)
–[ Code ]
29
Third culprit : the monitoring Aspect
• This aspect was introduced on purpose
• We should simply disable it [ Code ]
30
Results
• 1020 req/sec, still without any error
• Only 10% performance increase
31
32
#6
JDBC
vs
JPA
3 profiles are available
• Do you use Spring profiles?
• Choose between
–JDBC
–JPA
–Spring Data
33
Switch to JPA
• Change the profile in the web.xml file
• The application is a little bit slower
–904 req/sec
–After an initial peak, we see the application hanging and then
starting again -> looks like a GC issue
34
First problem : Memory
• JPA uses more PermGen, and more memory in general than
JDBC
• Let’s boost the application memory
–export MAVEN_OPTS="-XX:MaxPermSize=128m -Xms256m -
Xmx256m"
–1103 req/sec ! Better than JDBC !
• That’s a different result from our original blog entry
–Looks like we need more memory with JDK 7...
35
Second problem : SQL requests
• Run MySQL Workbench
–With JDBC we had more than 30 000 SQL requests per second
–With JPA we have 15 000 SQL requests per second
• Why isn’t performance better when we have only half as
many requests?
36
37
#7
Lazy
loading
Lazy loading & Open Session In View
• Pet.visits is an EAGER collection
–This is often a bad idea to eagerly fetch collections
• Let’s configure it with the default, lazy-loaded mode
• To prevent the dreaded LazyInitializationException we’ll use
the Open Session In View pattern
–Not the «perfect» solution, which would require more refactoring
–Good enough in this situation, and easy to implement
–[ Code ]
38
Results
• 1165 req/sec, still without any error
• 10 000 SQL req/sec
• We have beaten the JDBC version!
39
40
#8
Adding
cache
Hibernate Caching
• We have used Ehcache
• We have put Hibernate’s @Cache annotation everywhere
–Owners, Pets, Visits, etc...
41
Spring caching
• For more complex queries, we used Spring’s cache
abstraction
–Adds a caching aspect around slow methods
• Allowed us to remove the very slow «LIKE» in
JpaOwnerRepositoryImpl.findByLastName()
• We could also have used Hibernate’s query cache for the
same result
• [ Code ]
42
Results
• 1240 req/sec, still without any
error
• But can we do better?
43
44
#9
Extreme
testing
Extreme testing
• If we look at the JMeter report, we have reached JMeter’s
limits
–Adding more users (=threads) isn’t doing a big difference
• The solution is to do more with the existing threads
–Removed the counter
–Decreased the ramp-up period to 5 seconds
–Run without any listeners (or in command-line)
45
Results
• We achieved 3000 req/sec
• Memory stayed stable
–We even let it run until we had 100 000 user sessions
• We had to increase the JDBC pool size to 30
–Still a small number of connexions
–Pushing it to 40 decreases performance
46
47
Final
notes
Does JDK 7 helps?
• Tested the new G1 Garbage Collector
–export MAVEN_OPTS="-XX:MaxPermSize=128m -Xms256m -
Xmx256m -XX:+UseG1GC"
–3% to 5% slower
–Needs a bigger heap to work correctly
–Doesn’t do any miracle
48
Does the new MacBook Pro helps?
• Compared to my original blog posts, with my old MacBook
–We still have the memory issues (until solved)
–We still have the HTTP errors (until solved)
–Results are 10% to 20% better until the last,
«extreme testing» phase
• If you write inefficient code, a faster
CPU and a SSD won’t save
you
49
50
#1 Put the
application in
production
#2 Create a
JMeter test
#3
Profile
#4 Tune the
application
server
#5 Remove
locks
#7 Lazy loading
#6 JDBC vs JPA
#8 Add cache
51
Questions
&
Answers
@juliendubois
Late question?

Weitere ähnliche Inhalte

Was ist angesagt?

Migration tales from java ee 5 to 7
Migration tales from java ee 5 to 7Migration tales from java ee 5 to 7
Migration tales from java ee 5 to 7Roberto Cortez
 
[143]Inside fuse deview 2016
[143]Inside fuse   deview 2016[143]Inside fuse   deview 2016
[143]Inside fuse deview 2016NAVER D2
 
Devfest09 Cschalk Gwt
Devfest09 Cschalk GwtDevfest09 Cschalk Gwt
Devfest09 Cschalk GwtChris Schalk
 
Javantura 2014 - Java 8 JavaScript Nashorn
Javantura 2014 - Java 8 JavaScript NashornJavantura 2014 - Java 8 JavaScript Nashorn
Javantura 2014 - Java 8 JavaScript NashornMiroslav Resetar
 
Why jakarta ee matters (ConFoo 2021)
Why jakarta ee matters (ConFoo 2021)Why jakarta ee matters (ConFoo 2021)
Why jakarta ee matters (ConFoo 2021)Ryan Cuprak
 
Faster java ee builds with gradle [con4921]
Faster java ee builds with gradle [con4921]Faster java ee builds with gradle [con4921]
Faster java ee builds with gradle [con4921]Ryan Cuprak
 
jQuery Comes to XPages
jQuery Comes to XPagesjQuery Comes to XPages
jQuery Comes to XPagesTeamstudio
 
Full stack development with node and NoSQL - All Things Open - October 2017
Full stack development with node and NoSQL - All Things Open - October 2017Full stack development with node and NoSQL - All Things Open - October 2017
Full stack development with node and NoSQL - All Things Open - October 2017Matthew Groves
 
jQuery: The World's Most Popular JavaScript Library Comes to XPages
jQuery: The World's Most Popular JavaScript Library Comes to XPagesjQuery: The World's Most Popular JavaScript Library Comes to XPages
jQuery: The World's Most Popular JavaScript Library Comes to XPagesTeamstudio
 
Genomic Computation at Scale with Serverless, StackStorm and Docker Swarm
Genomic Computation at Scale with Serverless, StackStorm and Docker SwarmGenomic Computation at Scale with Serverless, StackStorm and Docker Swarm
Genomic Computation at Scale with Serverless, StackStorm and Docker SwarmDmitri Zimine
 
2015 Java update and roadmap, JUG sevilla
2015  Java update and roadmap, JUG sevilla2015  Java update and roadmap, JUG sevilla
2015 Java update and roadmap, JUG sevillaTrisha Gee
 
Developing realtime apps with Drupal and NodeJS
Developing realtime apps with Drupal and NodeJS Developing realtime apps with Drupal and NodeJS
Developing realtime apps with Drupal and NodeJS drupalcampest
 
Performance and Scalability Art of Isomorphic React Applications
Performance and Scalability Art of Isomorphic React ApplicationsPerformance and Scalability Art of Isomorphic React Applications
Performance and Scalability Art of Isomorphic React ApplicationsDenis Izmaylov
 
J1 2015 "Debugging Java Apps in Containers: No Heavy Welding Gear Required"
J1 2015 "Debugging Java Apps in Containers: No Heavy Welding Gear Required"J1 2015 "Debugging Java Apps in Containers: No Heavy Welding Gear Required"
J1 2015 "Debugging Java Apps in Containers: No Heavy Welding Gear Required"Daniel Bryant
 
From the Atlassian Labs: FedEx Champions - Atlassian Summit 2010 - Lightning ...
From the Atlassian Labs: FedEx Champions - Atlassian Summit 2010 - Lightning ...From the Atlassian Labs: FedEx Champions - Atlassian Summit 2010 - Lightning ...
From the Atlassian Labs: FedEx Champions - Atlassian Summit 2010 - Lightning ...Atlassian
 

Was ist angesagt? (20)

Javantura v7 - The State of Java - Today and Tomowwow - HUJAK's Community Key...
Javantura v7 - The State of Java - Today and Tomowwow - HUJAK's Community Key...Javantura v7 - The State of Java - Today and Tomowwow - HUJAK's Community Key...
Javantura v7 - The State of Java - Today and Tomowwow - HUJAK's Community Key...
 
Migration tales from java ee 5 to 7
Migration tales from java ee 5 to 7Migration tales from java ee 5 to 7
Migration tales from java ee 5 to 7
 
[143]Inside fuse deview 2016
[143]Inside fuse   deview 2016[143]Inside fuse   deview 2016
[143]Inside fuse deview 2016
 
Devfest09 Cschalk Gwt
Devfest09 Cschalk GwtDevfest09 Cschalk Gwt
Devfest09 Cschalk Gwt
 
Javantura 2014 - Java 8 JavaScript Nashorn
Javantura 2014 - Java 8 JavaScript NashornJavantura 2014 - Java 8 JavaScript Nashorn
Javantura 2014 - Java 8 JavaScript Nashorn
 
Why jakarta ee matters (ConFoo 2021)
Why jakarta ee matters (ConFoo 2021)Why jakarta ee matters (ConFoo 2021)
Why jakarta ee matters (ConFoo 2021)
 
Faster java ee builds with gradle [con4921]
Faster java ee builds with gradle [con4921]Faster java ee builds with gradle [con4921]
Faster java ee builds with gradle [con4921]
 
jQuery Comes to XPages
jQuery Comes to XPagesjQuery Comes to XPages
jQuery Comes to XPages
 
Apache Lucene for Java EE Developers
Apache Lucene for Java EE DevelopersApache Lucene for Java EE Developers
Apache Lucene for Java EE Developers
 
Full stack development with node and NoSQL - All Things Open - October 2017
Full stack development with node and NoSQL - All Things Open - October 2017Full stack development with node and NoSQL - All Things Open - October 2017
Full stack development with node and NoSQL - All Things Open - October 2017
 
jQuery: The World's Most Popular JavaScript Library Comes to XPages
jQuery: The World's Most Popular JavaScript Library Comes to XPagesjQuery: The World's Most Popular JavaScript Library Comes to XPages
jQuery: The World's Most Popular JavaScript Library Comes to XPages
 
Genomic Computation at Scale with Serverless, StackStorm and Docker Swarm
Genomic Computation at Scale with Serverless, StackStorm and Docker SwarmGenomic Computation at Scale with Serverless, StackStorm and Docker Swarm
Genomic Computation at Scale with Serverless, StackStorm and Docker Swarm
 
2015 Java update and roadmap, JUG sevilla
2015  Java update and roadmap, JUG sevilla2015  Java update and roadmap, JUG sevilla
2015 Java update and roadmap, JUG sevilla
 
JHipster overview
JHipster overviewJHipster overview
JHipster overview
 
Java 2012 conference keynote - Java Strategy & Roadmap - WebLogic & GlassFish...
Java 2012 conference keynote - Java Strategy & Roadmap - WebLogic & GlassFish...Java 2012 conference keynote - Java Strategy & Roadmap - WebLogic & GlassFish...
Java 2012 conference keynote - Java Strategy & Roadmap - WebLogic & GlassFish...
 
Developing realtime apps with Drupal and NodeJS
Developing realtime apps with Drupal and NodeJS Developing realtime apps with Drupal and NodeJS
Developing realtime apps with Drupal and NodeJS
 
GWT-Basics
GWT-BasicsGWT-Basics
GWT-Basics
 
Performance and Scalability Art of Isomorphic React Applications
Performance and Scalability Art of Isomorphic React ApplicationsPerformance and Scalability Art of Isomorphic React Applications
Performance and Scalability Art of Isomorphic React Applications
 
J1 2015 "Debugging Java Apps in Containers: No Heavy Welding Gear Required"
J1 2015 "Debugging Java Apps in Containers: No Heavy Welding Gear Required"J1 2015 "Debugging Java Apps in Containers: No Heavy Welding Gear Required"
J1 2015 "Debugging Java Apps in Containers: No Heavy Welding Gear Required"
 
From the Atlassian Labs: FedEx Champions - Atlassian Summit 2010 - Lightning ...
From the Atlassian Labs: FedEx Champions - Atlassian Summit 2010 - Lightning ...From the Atlassian Labs: FedEx Champions - Atlassian Summit 2010 - Lightning ...
From the Atlassian Labs: FedEx Champions - Atlassian Summit 2010 - Lightning ...
 

Ähnlich wie Performance tuning the Spring Pet Clinic sample application

Lessons Learned Replatforming A Large Machine Learning Application To Apache ...
Lessons Learned Replatforming A Large Machine Learning Application To Apache ...Lessons Learned Replatforming A Large Machine Learning Application To Apache ...
Lessons Learned Replatforming A Large Machine Learning Application To Apache ...Databricks
 
BTV PHP - Building Fast Websites
BTV PHP - Building Fast WebsitesBTV PHP - Building Fast Websites
BTV PHP - Building Fast WebsitesJonathan Klein
 
Silicon Valley Code Camp 2015 - Advanced MongoDB - The Sequel
Silicon Valley Code Camp 2015 - Advanced MongoDB - The SequelSilicon Valley Code Camp 2015 - Advanced MongoDB - The Sequel
Silicon Valley Code Camp 2015 - Advanced MongoDB - The SequelDaniel Coupal
 
Performance Tuning in the Trenches
Performance Tuning in the TrenchesPerformance Tuning in the Trenches
Performance Tuning in the TrenchesDonald Belcham
 
Benchmarking at Parse
Benchmarking at ParseBenchmarking at Parse
Benchmarking at ParseTravis Redman
 
Advanced Benchmarking at Parse
Advanced Benchmarking at ParseAdvanced Benchmarking at Parse
Advanced Benchmarking at ParseMongoDB
 
Performant Django - Ara Anjargolian
Performant Django - Ara AnjargolianPerformant Django - Ara Anjargolian
Performant Django - Ara AnjargolianHakka Labs
 
SOA with PHP and Symfony
SOA with PHP and SymfonySOA with PHP and Symfony
SOA with PHP and SymfonyMichalSchroeder
 
Adding Value in the Cloud with Performance Test
Adding Value in the Cloud with Performance TestAdding Value in the Cloud with Performance Test
Adding Value in the Cloud with Performance TestRodolfo Kohn
 
Open source: Top issues in the top enterprise packages
Open source: Top issues in the top enterprise packagesOpen source: Top issues in the top enterprise packages
Open source: Top issues in the top enterprise packagesRogue Wave Software
 
Cognos Performance Tuning Tips & Tricks
Cognos Performance Tuning Tips & TricksCognos Performance Tuning Tips & Tricks
Cognos Performance Tuning Tips & TricksSenturus
 
WebLogic Stability; Detect and Analyse Stuck Threads
WebLogic Stability; Detect and Analyse Stuck ThreadsWebLogic Stability; Detect and Analyse Stuck Threads
WebLogic Stability; Detect and Analyse Stuck ThreadsMaarten Smeets
 
Scaling apps for the big time
Scaling apps for the big timeScaling apps for the big time
Scaling apps for the big timeproitconsult
 
Improving Batch-Process Testing Techniques with a Domain-Specific Language
Improving Batch-Process Testing Techniques with a Domain-Specific LanguageImproving Batch-Process Testing Techniques with a Domain-Specific Language
Improving Batch-Process Testing Techniques with a Domain-Specific LanguageDr. Spock
 
ICONUK 2016: Back From the Dead: How Bad Code Kills a Good Server
ICONUK 2016: Back From the Dead: How Bad Code Kills a Good ServerICONUK 2016: Back From the Dead: How Bad Code Kills a Good Server
ICONUK 2016: Back From the Dead: How Bad Code Kills a Good ServerSerdar Basegmez
 
Profiling and Tuning a Web Application - The Dirty Details
Profiling and Tuning a Web Application - The Dirty DetailsProfiling and Tuning a Web Application - The Dirty Details
Profiling and Tuning a Web Application - The Dirty DetailsAchievers Tech
 
12-Step Program for Scaling Web Applications on PostgreSQL
12-Step Program for Scaling Web Applications on PostgreSQL12-Step Program for Scaling Web Applications on PostgreSQL
12-Step Program for Scaling Web Applications on PostgreSQLKonstantin Gredeskoul
 
MySQL Performance Tuning at COSCUP 2014
MySQL Performance Tuning at COSCUP 2014MySQL Performance Tuning at COSCUP 2014
MySQL Performance Tuning at COSCUP 2014Ryusuke Kajiyama
 

Ähnlich wie Performance tuning the Spring Pet Clinic sample application (20)

Lessons Learned Replatforming A Large Machine Learning Application To Apache ...
Lessons Learned Replatforming A Large Machine Learning Application To Apache ...Lessons Learned Replatforming A Large Machine Learning Application To Apache ...
Lessons Learned Replatforming A Large Machine Learning Application To Apache ...
 
BTV PHP - Building Fast Websites
BTV PHP - Building Fast WebsitesBTV PHP - Building Fast Websites
BTV PHP - Building Fast Websites
 
Silicon Valley Code Camp 2015 - Advanced MongoDB - The Sequel
Silicon Valley Code Camp 2015 - Advanced MongoDB - The SequelSilicon Valley Code Camp 2015 - Advanced MongoDB - The Sequel
Silicon Valley Code Camp 2015 - Advanced MongoDB - The Sequel
 
Performance Tuning in the Trenches
Performance Tuning in the TrenchesPerformance Tuning in the Trenches
Performance Tuning in the Trenches
 
Benchmarking at Parse
Benchmarking at ParseBenchmarking at Parse
Benchmarking at Parse
 
Advanced Benchmarking at Parse
Advanced Benchmarking at ParseAdvanced Benchmarking at Parse
Advanced Benchmarking at Parse
 
Performant Django - Ara Anjargolian
Performant Django - Ara AnjargolianPerformant Django - Ara Anjargolian
Performant Django - Ara Anjargolian
 
Fastest Servlets in the West
Fastest Servlets in the WestFastest Servlets in the West
Fastest Servlets in the West
 
SOA with PHP and Symfony
SOA with PHP and SymfonySOA with PHP and Symfony
SOA with PHP and Symfony
 
Adding Value in the Cloud with Performance Test
Adding Value in the Cloud with Performance TestAdding Value in the Cloud with Performance Test
Adding Value in the Cloud with Performance Test
 
Open source: Top issues in the top enterprise packages
Open source: Top issues in the top enterprise packagesOpen source: Top issues in the top enterprise packages
Open source: Top issues in the top enterprise packages
 
Cognos Performance Tuning Tips & Tricks
Cognos Performance Tuning Tips & TricksCognos Performance Tuning Tips & Tricks
Cognos Performance Tuning Tips & Tricks
 
WebLogic Stability; Detect and Analyse Stuck Threads
WebLogic Stability; Detect and Analyse Stuck ThreadsWebLogic Stability; Detect and Analyse Stuck Threads
WebLogic Stability; Detect and Analyse Stuck Threads
 
Scaling apps for the big time
Scaling apps for the big timeScaling apps for the big time
Scaling apps for the big time
 
Improving Batch-Process Testing Techniques with a Domain-Specific Language
Improving Batch-Process Testing Techniques with a Domain-Specific LanguageImproving Batch-Process Testing Techniques with a Domain-Specific Language
Improving Batch-Process Testing Techniques with a Domain-Specific Language
 
ICONUK 2016: Back From the Dead: How Bad Code Kills a Good Server
ICONUK 2016: Back From the Dead: How Bad Code Kills a Good ServerICONUK 2016: Back From the Dead: How Bad Code Kills a Good Server
ICONUK 2016: Back From the Dead: How Bad Code Kills a Good Server
 
Background processing with hangfire
Background processing with hangfireBackground processing with hangfire
Background processing with hangfire
 
Profiling and Tuning a Web Application - The Dirty Details
Profiling and Tuning a Web Application - The Dirty DetailsProfiling and Tuning a Web Application - The Dirty Details
Profiling and Tuning a Web Application - The Dirty Details
 
12-Step Program for Scaling Web Applications on PostgreSQL
12-Step Program for Scaling Web Applications on PostgreSQL12-Step Program for Scaling Web Applications on PostgreSQL
12-Step Program for Scaling Web Applications on PostgreSQL
 
MySQL Performance Tuning at COSCUP 2014
MySQL Performance Tuning at COSCUP 2014MySQL Performance Tuning at COSCUP 2014
MySQL Performance Tuning at COSCUP 2014
 

Mehr von Julien Dubois

Accessibility in the UK
Accessibility in the UKAccessibility in the UK
Accessibility in the UKJulien Dubois
 
Java on Azure "Back to Basics" series - databases introduction
Java on Azure "Back to Basics" series - databases introductionJava on Azure "Back to Basics" series - databases introduction
Java on Azure "Back to Basics" series - databases introductionJulien Dubois
 
JHipster Code 2020 keynote
JHipster Code 2020 keynoteJHipster Code 2020 keynote
JHipster Code 2020 keynoteJulien Dubois
 
Running Spring Boot microservices in the cloud
Running Spring Boot microservices in the cloudRunning Spring Boot microservices in the cloud
Running Spring Boot microservices in the cloudJulien Dubois
 
JHipster Conf 2019 English keynote
JHipster Conf 2019 English keynoteJHipster Conf 2019 English keynote
JHipster Conf 2019 English keynoteJulien Dubois
 
JHipster Conf 2019 French keynote
JHipster Conf 2019 French keynoteJHipster Conf 2019 French keynote
JHipster Conf 2019 French keynoteJulien Dubois
 
Créer et développer une communauté Open Source
Créer et développer une communauté Open SourceCréer et développer une communauté Open Source
Créer et développer une communauté Open SourceJulien Dubois
 
JHipster Conf 2018 Quiz
JHipster Conf 2018 QuizJHipster Conf 2018 Quiz
JHipster Conf 2018 QuizJulien Dubois
 
Devoxx Belgium 2017 - easy microservices with JHipster
Devoxx Belgium 2017 - easy microservices with JHipsterDevoxx Belgium 2017 - easy microservices with JHipster
Devoxx Belgium 2017 - easy microservices with JHipsterJulien Dubois
 
JHipster overview and roadmap (August 2017)
JHipster overview and roadmap (August 2017)JHipster overview and roadmap (August 2017)
JHipster overview and roadmap (August 2017)Julien Dubois
 
Être productif avec JHipster - Devoxx France 2017
Être productif avec JHipster - Devoxx France 2017Être productif avec JHipster - Devoxx France 2017
Être productif avec JHipster - Devoxx France 2017Julien Dubois
 
Devoxx : being productive with JHipster
Devoxx : being productive with JHipsterDevoxx : being productive with JHipster
Devoxx : being productive with JHipsterJulien Dubois
 
Requêtes multi-critères avec Cassandra
Requêtes multi-critères avec CassandraRequêtes multi-critères avec Cassandra
Requêtes multi-critères avec CassandraJulien Dubois
 
JHipster à Devoxx 2015
JHipster à Devoxx 2015JHipster à Devoxx 2015
JHipster à Devoxx 2015Julien Dubois
 
Développer et déployer dans le cloud
Développer et déployer dans le cloudDévelopper et déployer dans le cloud
Développer et déployer dans le cloudJulien Dubois
 
JHipster for Spring Boot webinar
JHipster for Spring Boot webinarJHipster for Spring Boot webinar
JHipster for Spring Boot webinarJulien Dubois
 
Gérer son environnement de développement avec Docker
Gérer son environnement de développement avec DockerGérer son environnement de développement avec Docker
Gérer son environnement de développement avec DockerJulien Dubois
 
HTML5, Spring, NoSQL et mobilité
HTML5, Spring, NoSQL et mobilitéHTML5, Spring, NoSQL et mobilité
HTML5, Spring, NoSQL et mobilitéJulien Dubois
 

Mehr von Julien Dubois (20)

Accessibility in the UK
Accessibility in the UKAccessibility in the UK
Accessibility in the UK
 
Java on Azure "Back to Basics" series - databases introduction
Java on Azure "Back to Basics" series - databases introductionJava on Azure "Back to Basics" series - databases introduction
Java on Azure "Back to Basics" series - databases introduction
 
JHipster Code 2020 keynote
JHipster Code 2020 keynoteJHipster Code 2020 keynote
JHipster Code 2020 keynote
 
Running Spring Boot microservices in the cloud
Running Spring Boot microservices in the cloudRunning Spring Boot microservices in the cloud
Running Spring Boot microservices in the cloud
 
Spring on Azure
Spring on AzureSpring on Azure
Spring on Azure
 
JHipster Conf 2019 English keynote
JHipster Conf 2019 English keynoteJHipster Conf 2019 English keynote
JHipster Conf 2019 English keynote
 
JHipster Conf 2019 French keynote
JHipster Conf 2019 French keynoteJHipster Conf 2019 French keynote
JHipster Conf 2019 French keynote
 
Créer et développer une communauté Open Source
Créer et développer une communauté Open SourceCréer et développer une communauté Open Source
Créer et développer une communauté Open Source
 
JHipster Conf 2018 Quiz
JHipster Conf 2018 QuizJHipster Conf 2018 Quiz
JHipster Conf 2018 Quiz
 
Devoxx Belgium 2017 - easy microservices with JHipster
Devoxx Belgium 2017 - easy microservices with JHipsterDevoxx Belgium 2017 - easy microservices with JHipster
Devoxx Belgium 2017 - easy microservices with JHipster
 
JHipster overview and roadmap (August 2017)
JHipster overview and roadmap (August 2017)JHipster overview and roadmap (August 2017)
JHipster overview and roadmap (August 2017)
 
Être productif avec JHipster - Devoxx France 2017
Être productif avec JHipster - Devoxx France 2017Être productif avec JHipster - Devoxx France 2017
Être productif avec JHipster - Devoxx France 2017
 
Devoxx : being productive with JHipster
Devoxx : being productive with JHipsterDevoxx : being productive with JHipster
Devoxx : being productive with JHipster
 
Requêtes multi-critères avec Cassandra
Requêtes multi-critères avec CassandraRequêtes multi-critères avec Cassandra
Requêtes multi-critères avec Cassandra
 
JHipster à Devoxx 2015
JHipster à Devoxx 2015JHipster à Devoxx 2015
JHipster à Devoxx 2015
 
Développer et déployer dans le cloud
Développer et déployer dans le cloudDévelopper et déployer dans le cloud
Développer et déployer dans le cloud
 
JHipster for Spring Boot webinar
JHipster for Spring Boot webinarJHipster for Spring Boot webinar
JHipster for Spring Boot webinar
 
Gérer son environnement de développement avec Docker
Gérer son environnement de développement avec DockerGérer son environnement de développement avec Docker
Gérer son environnement de développement avec Docker
 
De Devoxx au CAC40
De Devoxx au CAC40De Devoxx au CAC40
De Devoxx au CAC40
 
HTML5, Spring, NoSQL et mobilité
HTML5, Spring, NoSQL et mobilitéHTML5, Spring, NoSQL et mobilité
HTML5, Spring, NoSQL et mobilité
 

Kürzlich hochgeladen

DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 

Kürzlich hochgeladen (20)

DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 

Performance tuning the Spring Pet Clinic sample application

  • 1. © 2013 SpringOne 2GX. All rights reserved. Do not distribute without permission. Performance-tuning the «Spring Pet Clinic» sample application By Julien Dubois
  • 2. About me • Julien Dubois • From Paris, France • Co-authored «Spring par la pratique» (French book on Spring) • Former SpringSource France director • Director of Consulting at Ippon Technologies • Follow me @juliendubois 2
  • 3. Goals of this presentation • Make a specific application run faster • Learn classic issues with Spring Web applications • Learn our methodology to solve performance issues 3
  • 4. More information on this presentation • This presentation started with a series of blog posts: http://blog.ippon.fr/tag/spring-petclinic/ • You can run your own tests, every step is cleanly commited on Github: https://github.com/jdubois/spring-petclinic 4
  • 5. What’s new since the blog entries? • Java 7 • I got a brand new MacBook :-) –Does a SSD really matters? –Does the new core i7 matters? 5
  • 7. Do you remember the Sun Java Pet Store? • Used to explain how you could build an incredibly complex application • On a very expensive application server • With an horrible-looking result • When your customer only wanted a simple Web app 7
  • 8. The Spring Pet Clinic • Is here to demonstrate Spring features and best practices • Is a very classical MVC-style application (no REST + funky JS library) • Is still a good excuse to use cute dogs in your presentation 8
  • 9. More information on the Spring Pet Clinic • Code: https://github.com/SpringSource/spring-petclinic/ • Short presentation: https://speakerdeck.com/michaelisvy/spring-petclinic-sample- application 9
  • 11. Moving to production • Be as close as possible to a «production environment» –Remove «debugging» logs [ Code ] –Use a «real» database [ Code ] • For this presentation our environment isn’t perfect –Everything runs on the same machine –Even the presentation itself :-) 11
  • 12. Memory tuning • We’re running the application from the Maven Tomcat plugin –Of course Maven takes some resources • Still the application runs with a small memory footprint –export MAVEN_OPTS="-XX:MaxPermSize=64m -Xms128m - Xmx128m" • Why not use more memory? –It’s easier to spot memory problems –We don’t need it (we’re not using a big fat Java EE server!) 12
  • 14. Simulate load • JMeter will simulate users –500 users –In a «realistic» way • Use a timer • Check «clear cookies each iteration?» 14
  • 15. Results • 250 req/sec • Lots of errors • Quickly ends with a crash... 15
  • 17. Does profiling distort results? • Short answer : not a lot –We’ll see this when the application runs better • We have used JProfiler and VisualVM in production many times –Often caused less trouble than official «production monitoring tools» like HP Diagnostics –Only way to find problems and understand what’s going on –Easy to install 17
  • 18. Choose your weapon • VisualVM –Free & lightweight –Included in the JDK • JProfiler –Best tool we’ve used • YourKit –Easy to use & cheap 18
  • 19. First culprit : Dandelion • More specifically, Dandelion module for DataTables –https://github.com/dandelion/dandelion-datatables • Nice & fun JSP taglib for rendering JQuery DataTables –Has a memory leak in this version –Is now corrected (extremely quick response time from the Dandelion team) • So we switched to «plain old JQuery DataTables» [ Code ] 19
  • 20. Second culprit : the HTTP Session • Using HTTP Sessions can be helpful –Developer productivity –Data security • Going stateless is often better –Uses less RAM –More scalable 20
  • 21. Going stateless • Example : the PetController.processUpdateForm() method –Use Spring MVC REST to get more information from the URL –Fetch again the missing data • We said more scalability, not more performance (for the moment) • With some work, the whole application can become stateless [ Code ] 21
  • 22. Results • 500 req/sec • A few errors • That’s a lot better than before! 22
  • 24. Tomcat tuning • This is the easiest step –Migrate to the latest version of the Tomcat plugin –Use the new NIO connector • org.apache.coyote.http11.Http11NioProtocol • [ Code ] 24
  • 25. 25 • 950 req/sec • No errors • Victory :-) Results
  • 27. Locks • Locks are blocked threads –Aka «there’s a synchronized somewhere» • They obviously cause scalability problems • Let’s launch our profiler again! 27
  • 28. First culprit : commons DBCP • Commons DBCP does a lot of synchronization • We replaced it with Tomcat JDBC –New JDBC pool for Tomcat, for highly concurrent systems • But we have kept the pool size at 8 –So obviously we will still have locks –Making it bigger hinders performance • If the database was on a separate server, we would use a bigger number • The database is always the problem • [ Code ] 28
  • 29. Second culprit : Webjars • WebJars are client-side libraries (JQuery, etc...) packaged as Jar files –http://www.webjars.org/ –Those libraries are loaded from the classloader • Which does a big lock each time it is accessed • So if you have a lot of libraries this can be a real problem • There are many solutions to this issue –Cache those resources with a proxy server –Use another solution for loading those libraries (Bower ?) –[ Code ] 29
  • 30. Third culprit : the monitoring Aspect • This aspect was introduced on purpose • We should simply disable it [ Code ] 30
  • 31. Results • 1020 req/sec, still without any error • Only 10% performance increase 31
  • 33. 3 profiles are available • Do you use Spring profiles? • Choose between –JDBC –JPA –Spring Data 33
  • 34. Switch to JPA • Change the profile in the web.xml file • The application is a little bit slower –904 req/sec –After an initial peak, we see the application hanging and then starting again -> looks like a GC issue 34
  • 35. First problem : Memory • JPA uses more PermGen, and more memory in general than JDBC • Let’s boost the application memory –export MAVEN_OPTS="-XX:MaxPermSize=128m -Xms256m - Xmx256m" –1103 req/sec ! Better than JDBC ! • That’s a different result from our original blog entry –Looks like we need more memory with JDK 7... 35
  • 36. Second problem : SQL requests • Run MySQL Workbench –With JDBC we had more than 30 000 SQL requests per second –With JPA we have 15 000 SQL requests per second • Why isn’t performance better when we have only half as many requests? 36
  • 38. Lazy loading & Open Session In View • Pet.visits is an EAGER collection –This is often a bad idea to eagerly fetch collections • Let’s configure it with the default, lazy-loaded mode • To prevent the dreaded LazyInitializationException we’ll use the Open Session In View pattern –Not the «perfect» solution, which would require more refactoring –Good enough in this situation, and easy to implement –[ Code ] 38
  • 39. Results • 1165 req/sec, still without any error • 10 000 SQL req/sec • We have beaten the JDBC version! 39
  • 41. Hibernate Caching • We have used Ehcache • We have put Hibernate’s @Cache annotation everywhere –Owners, Pets, Visits, etc... 41
  • 42. Spring caching • For more complex queries, we used Spring’s cache abstraction –Adds a caching aspect around slow methods • Allowed us to remove the very slow «LIKE» in JpaOwnerRepositoryImpl.findByLastName() • We could also have used Hibernate’s query cache for the same result • [ Code ] 42
  • 43. Results • 1240 req/sec, still without any error • But can we do better? 43
  • 45. Extreme testing • If we look at the JMeter report, we have reached JMeter’s limits –Adding more users (=threads) isn’t doing a big difference • The solution is to do more with the existing threads –Removed the counter –Decreased the ramp-up period to 5 seconds –Run without any listeners (or in command-line) 45
  • 46. Results • We achieved 3000 req/sec • Memory stayed stable –We even let it run until we had 100 000 user sessions • We had to increase the JDBC pool size to 30 –Still a small number of connexions –Pushing it to 40 decreases performance 46
  • 48. Does JDK 7 helps? • Tested the new G1 Garbage Collector –export MAVEN_OPTS="-XX:MaxPermSize=128m -Xms256m - Xmx256m -XX:+UseG1GC" –3% to 5% slower –Needs a bigger heap to work correctly –Doesn’t do any miracle 48
  • 49. Does the new MacBook Pro helps? • Compared to my original blog posts, with my old MacBook –We still have the memory issues (until solved) –We still have the HTTP errors (until solved) –Results are 10% to 20% better until the last, «extreme testing» phase • If you write inefficient code, a faster CPU and a SSD won’t save you 49
  • 50. 50 #1 Put the application in production #2 Create a JMeter test #3 Profile #4 Tune the application server #5 Remove locks #7 Lazy loading #6 JDBC vs JPA #8 Add cache