SlideShare uma empresa Scribd logo
1 de 49
Tuning Java Servers
Srinath Perera
Outline
 With size of systems growing, Performance
become increasingly critical for both R&D as
well as support
o Less performance => more machines => lot of
Devops costs and potential for failures
 We will do
o Bit of Theory
o Then to Profiling
 Will discuss different profiling views, and most
importantly when to use them.
Based on article
http://www.infoq.com/articles/Tuning-Java-Servers
Big Pic
What is Performance Tuning?
 Get maximum out of the machine
o Max Throughput
o Min Latency
 Often this become a tradeoff, so you need a
balance
o General case is to get max throughput within given
latency limits. (E.g. max throughput with latency
less than 100ms.)
Lets understand what they are
 What is throughput?
o Number of messages server can process per second
o Measured as
the number of messages processed/ time to process messages
 What is latency?
o End to end time for a server to process an message
 We discuss performance as relationship
between three variables: latency,
concurrency, throughput
What Limits Performance?
 Lack of resources
 Bottleneck – most scarce resource decides the
performance
o CPU bound
o Disk bound
o Bandwidth bound
o Latency bound
o Memory bound
Performance and Bottlenecks
 Think of performance as a water pipe system
 Bottle neck decides overall throughput
 Latency problems often caused at the same
bottlenecks due to contention
 Potential Bottlenecks (Resources)
o CPU
o Disk
o Network
o Memory
- Available Memory
- Heap Size
- GC (Java) – will eat in CPU
Performance of a Server
Little’s Law
 Bound your queue’s (reject too much requests
to give better response time)
Amdhal’s Law
Performance Numbers (based on Jeff
Dean’s numbers )
Latency / time
for 1 memory
Op
If Memory
access is a
Second
L1 cache reference 0.05 1/20th sec
Main memory reference 1 1 sec
Send 2K bytes over 1 Gbps network 200 3 min
Read 1 MB sequentially from memory 2500 41 min
Disk seek 1*10^5 27 hours
Read 1 MB sequentially from disk 2*10^5 2 days
Send packet CA->Netherlands->CA 1.5*10^6 17 days
See http://tapestryjava.blogspot.com/2012/06/latency-numbers-every-
programmer-should.html
Performance Numbers (based on Jeff
Dean’s numbers )
Latency / time
for 1 memory
Op
If Memory
access is a
Second
L1 cache reference 0.05 1/20th sec
Main memory reference 1 1 sec
Send 2K bytes over 1 Gbps network 200 3 min
Read 1 MB sequentially from memory 2500 41 min
Disk seek 1*10^5 27 hours
Read 1 MB sequentially from disk 2*10^5 2 days
Send packet CA->Netherlands->CA 1.5*10^6 17 days
See http://tapestryjava.blogspot.com/2012/06/latency-numbers-every-
programmer-should.html
Latency Lags Bandwidth
 Observation in prof.
Patterson’s Keynote at 2004
 Bandwidth improves, but
not latency
 Same holds now, and the
gap is widening with new
systems
Handling Speed Differences in
Memory Hierarchy
1. Caching
o E.g. Processor caches, file
cache, disk cache, permission
cache
2. Replication
o E.g. RAID, Content Distribution
Networks (CDN), Web Cache
3. Prediction – Predict what data
will be needed and prefect
o Tradeoff bandwidth
o E.g. disk caches, Google Earth
Potential Performance Problems
 Low performance
o Low Throughput
o High latency
 Memory leaks
 File, Thread, Connection Leaks
Warning
 Many think performance is due to CPU
 People forget network and Disk (most our
workloads are network bound)
o That’s why CPU 10% but machine is loaded (load
average 40)
 Need to look at all
 First step is find the bottleneck
Where to start? Load Average
 Most start by looking at CPU usage
 That does not reflect non-CPU load
 Load average is much better
o Represent the size of the process queue
o Can found via top (1m, 5m, 15m)
o Goes high when CPU, network, disk, memory etc.,
are limited
o Normal value = number of cores, 4X number of
cores means high
o 10X core size means machine is unusable
Read
• http://prutser.wordpress.com/2012/04/23/understanding-linux-load-average-
part-1/ also part2 and part 3
Profiling Tools
 First step is connect through JConsole, and get
basic idea.
 Also monitor the load average, CPU usage, and
IO operations (via top or Sar)
 Then you can switch to tools like JProfiler,
Yourkit, Java Flight Recorder
 Important views
o CPU views (bottlenecks)
o Thread views and monitor views
o Memory views (GC, allocations, and memory leaks)
o IO and JDBC tracing
Top
JConsole
Java Flight Recorder
 Former Oracle Jrocket Mission control
 Now included with JDK 7 update 44+
 Nice tool, very fast, you could run it in
production
 Can start via $JAVA_HOME/bin/jmc
 Profiling JVM need to have following java
option at start
o -XX:+UnlockCommercialFeatures -XX:+FlightRecorder
Hands On
 Code and scripts from
https://github.com/srinathperera/JavaProfilingTalk
 Run ant to build the service
 Download and unzip WSO2 AS. Run wso2server.sh to
start
 Go to http:// 127.0.0.1:9443/carbon and login via
admin/ admin
 Deploy the aar by going to Services->Add->AAR
Service
 Download jmeter, unzip, and run bin/jmeter
 Run Jmeter scripts to recreate performance problems
Get started with JProfiler
 Download install – work with linux, windows,
and Mac
 New Session, then configure
o Same Machine connect
o Remote connect
- Java -
agentpath:/Applications/jprofiler7/bin/macos/libjprofil
erti.jnilib=port=8849 
o Offline profile
 Adjust filters to org.wos2, org.apache,
java.util. and remove excludes (can change
this)
 Connect
JProfiler
 Instrumentation vs. Sampling
 Jpenable let you connect to an running server
remotely
Problem 1: Tuning for Throughput
 Is machine loaded (checked via load average)?
o If you are putting small load, throughout will be
less
 Try increasing concurrency (load)
Problem 1: Tuning for.. (Contd)
 If load average low
o Check lock profile
o Try tuning threads
- If server set to small number of threads, that will limit
performance
o Ensure network not saturated
- Try transfer a large file
Problem 1: Tuning for.. (Contd)
 If high load average
o Is machine loaded by something else?
o Check CPU (top)
- If high check CPU profile
- If GC percentage > 10% tune GC
o Check network
o Check Disk
o Check is Machine paging
CPU Profile
CPU Profile
 First check hotspots
 Then call tree
o show inherent time as oppose to cumulative time
(Call graph)
 Make sure what takes CPU is where real work is
done
 CPU1 and CPU2 samples
Network/ Disk Profile
 Enable Socket or Servlet (or Files) via Probes
 Hotspots
 Read/Write via telematics
 Samples tooManyIOPSCall.jmx
tooManyNetowrkCalls.jmx
Lock Profile
 Threads view (History and telemetric view)
 Monitor view
 bockedThreadsCall.jmx sample
Problem 2: Tuning for Latency
 Look for bottlenecks – same causes add latency
due to queuing
o Try to find any queue are growing
 Check thread views and lock views
o As discussed in Lock profile
 All IO (both disk and network) are expensive
o Network and Disk Profiles
 How to find?
o Call Graph
o Put system outs and check
Problem 3: Finding Memory Leaks
 Use Eclipse Memory Analyzer
 Go to JProfiler if it is hard to pin down
 Support mark and monitoring memory in
running system
 Can also analyze a memory dump
o Select the objects
o Checking incoming references (cumulative)
o Reference Graph can also help
Eclipse Memory Analyzer
 When OOM, WSO2 servers create a dump
 Open with eclipse memory analyzer
Memory leaks with Jprofiler
Allocation view
 Use to find where objects are created
GC Tuning
 If time spent on GC > 10%, then should tune GC
 “gc overhead limit exceeded” – means > 90%
time spent on GC
GC Tuning
 If time spent on GC > 10%, then should tune GC
 “gc overhead limit exceeded” – means > 90%
time spent on GC
 Consider using allocation views to reduce
objects created
Problem 4: Finding Thread Leaks
 Check the number of threads in thread graph
 Check which thread are created
 Thread dumps
o jstack <pid> >> threaddumps.log
o Jprofiler can get thread dumps as well
 Take thread dumps at different times
Thread Views
Problem 3: Connection Leaks
 Exhausted pools, file descriptor limits
 Check at finally points and in catch clauses
Tuning without an GUI
 Create a JProfile session and configure the triggers.
o Need Periodic triggers Copy local .jprofiler7/config.xml and
JProfiler binaries or agent code to the remote machine
 Add following before the java command.
o -
agentpath:JPROF_LOCATION/bin/macos/libjprofilerti.jnilib=offline,id=S
ESSION_ID,config=/Users/srinath/.jprofiler7/config.xml
 Here replace the configuration file and JProfiler location with
your machine's values.
o SESSION_ID is the session ID of the session you created with JProfiler UI.
Here ~./jprofiler7/config.xml file has settings for all sessions creates by
jprofiler, and it will pick up the right value. If you are profiling in a
remote machine copy your local configs to the remote host.
 Start and run the program, and it will print the following
 JProfiler> Using JVMTI
 ..
 Open the snapshot file and analyze using JProfiler UI.
Tuning
 OS Level Tuning
o For example,
http://www.lognormal.com/blog/2012/09/27/linu
x-tcpip-tuning/
o Generally available with the product
o It depends on OS etc.
 Product Tuning
o Thread pools sizes mainly, there may be others
 Application Tuning
o This is your application, you need to profile
Conclusion
 Know the goals
 Find where the bottleneck using Load average and
other OS tools
 Zoom in using profiler
 Know profile views and when to use them
 Details are important, so is the big picture
 Think .. Think ..
References
 Responding in a Timely Manner,
https://www.youtube.com/watch?v=q_DCipkM
sy0
 Tuning Java Servers -
http://www.infoq.com/articles/Tuning-Java-
Servers
 Thinking Clearly about Performance,
http://queue.acm.org/detail.cfm?id=1854041#
content-comments
Questions?

Mais conteúdo relacionado

Mais procurados

Albert Bifet – Apache Samoa: Mining Big Data Streams with Apache Flink
Albert Bifet – Apache Samoa: Mining Big Data Streams with Apache FlinkAlbert Bifet – Apache Samoa: Mining Big Data Streams with Apache Flink
Albert Bifet – Apache Samoa: Mining Big Data Streams with Apache FlinkFlink Forward
 
A full Machine learning pipeline in Scikit-learn vs in scala-Spark: pros and ...
A full Machine learning pipeline in Scikit-learn vs in scala-Spark: pros and ...A full Machine learning pipeline in Scikit-learn vs in scala-Spark: pros and ...
A full Machine learning pipeline in Scikit-learn vs in scala-Spark: pros and ...Jose Quesada (hiring)
 
Deep Learning with MXNet - Dmitry Larko
Deep Learning with MXNet - Dmitry LarkoDeep Learning with MXNet - Dmitry Larko
Deep Learning with MXNet - Dmitry LarkoSri Ambati
 
Snorkel: Dark Data and Machine Learning with Christopher Ré
Snorkel: Dark Data and Machine Learning with Christopher RéSnorkel: Dark Data and Machine Learning with Christopher Ré
Snorkel: Dark Data and Machine Learning with Christopher RéJen Aman
 
PyData 2015 Keynote: "A Systems View of Machine Learning"
PyData 2015 Keynote: "A Systems View of Machine Learning" PyData 2015 Keynote: "A Systems View of Machine Learning"
PyData 2015 Keynote: "A Systems View of Machine Learning" Joshua Bloom
 
Building High Available and Scalable Machine Learning Applications
Building High Available and Scalable Machine Learning ApplicationsBuilding High Available and Scalable Machine Learning Applications
Building High Available and Scalable Machine Learning ApplicationsYalçın Yenigün
 
Data Science with Spark
Data Science with SparkData Science with Spark
Data Science with SparkKrishna Sankar
 
Strata 2014 Talk:Tracking a Soccer Game with Big Data
Strata 2014 Talk:Tracking a Soccer Game with Big DataStrata 2014 Talk:Tracking a Soccer Game with Big Data
Strata 2014 Talk:Tracking a Soccer Game with Big DataSrinath Perera
 
Mining data streams
Mining data streamsMining data streams
Mining data streamsAkash Gupta
 
Cloud-based Data Stream Processing
Cloud-based Data Stream ProcessingCloud-based Data Stream Processing
Cloud-based Data Stream ProcessingZbigniew Jerzak
 
A Scaleable Implementation of Deep Learning on Spark -Alexander Ulanov
A Scaleable Implementation of Deep Learning on Spark -Alexander UlanovA Scaleable Implementation of Deep Learning on Spark -Alexander Ulanov
A Scaleable Implementation of Deep Learning on Spark -Alexander UlanovSpark Summit
 
Deep-Dive into Deep Learning Pipelines with Sue Ann Hong and Tim Hunter
Deep-Dive into Deep Learning Pipelines with Sue Ann Hong and Tim HunterDeep-Dive into Deep Learning Pipelines with Sue Ann Hong and Tim Hunter
Deep-Dive into Deep Learning Pipelines with Sue Ann Hong and Tim HunterDatabricks
 
Advanced Data Science on Spark-(Reza Zadeh, Stanford)
Advanced Data Science on Spark-(Reza Zadeh, Stanford)Advanced Data Science on Spark-(Reza Zadeh, Stanford)
Advanced Data Science on Spark-(Reza Zadeh, Stanford)Spark Summit
 
Machine Learning with Spark
Machine Learning with SparkMachine Learning with Spark
Machine Learning with Sparkelephantscale
 
Streaming Algorithms
Streaming AlgorithmsStreaming Algorithms
Streaming AlgorithmsJoe Kelley
 
IEEE Cloud 2012: Clouds Hands-On Tutorial
IEEE Cloud 2012: Clouds Hands-On TutorialIEEE Cloud 2012: Clouds Hands-On Tutorial
IEEE Cloud 2012: Clouds Hands-On TutorialSrinath Perera
 
TensorFrames: Google Tensorflow on Apache Spark
TensorFrames: Google Tensorflow on Apache SparkTensorFrames: Google Tensorflow on Apache Spark
TensorFrames: Google Tensorflow on Apache SparkDatabricks
 
High Performance Machine Learning in R with H2O
High Performance Machine Learning in R with H2OHigh Performance Machine Learning in R with H2O
High Performance Machine Learning in R with H2OSri Ambati
 
A Practical Guide to Anomaly Detection for DevOps
A Practical Guide to Anomaly Detection for DevOpsA Practical Guide to Anomaly Detection for DevOps
A Practical Guide to Anomaly Detection for DevOpsBigPanda
 
Spark Meetup @ Netflix, 05/19/2015
Spark Meetup @ Netflix, 05/19/2015Spark Meetup @ Netflix, 05/19/2015
Spark Meetup @ Netflix, 05/19/2015Yves Raimond
 

Mais procurados (20)

Albert Bifet – Apache Samoa: Mining Big Data Streams with Apache Flink
Albert Bifet – Apache Samoa: Mining Big Data Streams with Apache FlinkAlbert Bifet – Apache Samoa: Mining Big Data Streams with Apache Flink
Albert Bifet – Apache Samoa: Mining Big Data Streams with Apache Flink
 
A full Machine learning pipeline in Scikit-learn vs in scala-Spark: pros and ...
A full Machine learning pipeline in Scikit-learn vs in scala-Spark: pros and ...A full Machine learning pipeline in Scikit-learn vs in scala-Spark: pros and ...
A full Machine learning pipeline in Scikit-learn vs in scala-Spark: pros and ...
 
Deep Learning with MXNet - Dmitry Larko
Deep Learning with MXNet - Dmitry LarkoDeep Learning with MXNet - Dmitry Larko
Deep Learning with MXNet - Dmitry Larko
 
Snorkel: Dark Data and Machine Learning with Christopher Ré
Snorkel: Dark Data and Machine Learning with Christopher RéSnorkel: Dark Data and Machine Learning with Christopher Ré
Snorkel: Dark Data and Machine Learning with Christopher Ré
 
PyData 2015 Keynote: "A Systems View of Machine Learning"
PyData 2015 Keynote: "A Systems View of Machine Learning" PyData 2015 Keynote: "A Systems View of Machine Learning"
PyData 2015 Keynote: "A Systems View of Machine Learning"
 
Building High Available and Scalable Machine Learning Applications
Building High Available and Scalable Machine Learning ApplicationsBuilding High Available and Scalable Machine Learning Applications
Building High Available and Scalable Machine Learning Applications
 
Data Science with Spark
Data Science with SparkData Science with Spark
Data Science with Spark
 
Strata 2014 Talk:Tracking a Soccer Game with Big Data
Strata 2014 Talk:Tracking a Soccer Game with Big DataStrata 2014 Talk:Tracking a Soccer Game with Big Data
Strata 2014 Talk:Tracking a Soccer Game with Big Data
 
Mining data streams
Mining data streamsMining data streams
Mining data streams
 
Cloud-based Data Stream Processing
Cloud-based Data Stream ProcessingCloud-based Data Stream Processing
Cloud-based Data Stream Processing
 
A Scaleable Implementation of Deep Learning on Spark -Alexander Ulanov
A Scaleable Implementation of Deep Learning on Spark -Alexander UlanovA Scaleable Implementation of Deep Learning on Spark -Alexander Ulanov
A Scaleable Implementation of Deep Learning on Spark -Alexander Ulanov
 
Deep-Dive into Deep Learning Pipelines with Sue Ann Hong and Tim Hunter
Deep-Dive into Deep Learning Pipelines with Sue Ann Hong and Tim HunterDeep-Dive into Deep Learning Pipelines with Sue Ann Hong and Tim Hunter
Deep-Dive into Deep Learning Pipelines with Sue Ann Hong and Tim Hunter
 
Advanced Data Science on Spark-(Reza Zadeh, Stanford)
Advanced Data Science on Spark-(Reza Zadeh, Stanford)Advanced Data Science on Spark-(Reza Zadeh, Stanford)
Advanced Data Science on Spark-(Reza Zadeh, Stanford)
 
Machine Learning with Spark
Machine Learning with SparkMachine Learning with Spark
Machine Learning with Spark
 
Streaming Algorithms
Streaming AlgorithmsStreaming Algorithms
Streaming Algorithms
 
IEEE Cloud 2012: Clouds Hands-On Tutorial
IEEE Cloud 2012: Clouds Hands-On TutorialIEEE Cloud 2012: Clouds Hands-On Tutorial
IEEE Cloud 2012: Clouds Hands-On Tutorial
 
TensorFrames: Google Tensorflow on Apache Spark
TensorFrames: Google Tensorflow on Apache SparkTensorFrames: Google Tensorflow on Apache Spark
TensorFrames: Google Tensorflow on Apache Spark
 
High Performance Machine Learning in R with H2O
High Performance Machine Learning in R with H2OHigh Performance Machine Learning in R with H2O
High Performance Machine Learning in R with H2O
 
A Practical Guide to Anomaly Detection for DevOps
A Practical Guide to Anomaly Detection for DevOpsA Practical Guide to Anomaly Detection for DevOps
A Practical Guide to Anomaly Detection for DevOps
 
Spark Meetup @ Netflix, 05/19/2015
Spark Meetup @ Netflix, 05/19/2015Spark Meetup @ Netflix, 05/19/2015
Spark Meetup @ Netflix, 05/19/2015
 

Destaque

Java application server in the cloud
Java application server in the cloudJava application server in the cloud
Java application server in the cloudadm_exoplatform
 
Gradle build automation tool
Gradle   build automation toolGradle   build automation tool
Gradle build automation toolIoan Eugen Stan
 
Enterprise Integration Patterns with Apache Camel
Enterprise Integration Patterns with Apache CamelEnterprise Integration Patterns with Apache Camel
Enterprise Integration Patterns with Apache CamelIoan Eugen Stan
 
Memory Management: What You Need to Know When Moving to Java 8
Memory Management: What You Need to Know When Moving to Java 8Memory Management: What You Need to Know When Moving to Java 8
Memory Management: What You Need to Know When Moving to Java 8AppDynamics
 
Blazing Performance with Flame Graphs
Blazing Performance with Flame GraphsBlazing Performance with Flame Graphs
Blazing Performance with Flame GraphsBrendan Gregg
 
Introducing Ballerina
Introducing BallerinaIntroducing Ballerina
Introducing BallerinaWSO2
 

Destaque (6)

Java application server in the cloud
Java application server in the cloudJava application server in the cloud
Java application server in the cloud
 
Gradle build automation tool
Gradle   build automation toolGradle   build automation tool
Gradle build automation tool
 
Enterprise Integration Patterns with Apache Camel
Enterprise Integration Patterns with Apache CamelEnterprise Integration Patterns with Apache Camel
Enterprise Integration Patterns with Apache Camel
 
Memory Management: What You Need to Know When Moving to Java 8
Memory Management: What You Need to Know When Moving to Java 8Memory Management: What You Need to Know When Moving to Java 8
Memory Management: What You Need to Know When Moving to Java 8
 
Blazing Performance with Flame Graphs
Blazing Performance with Flame GraphsBlazing Performance with Flame Graphs
Blazing Performance with Flame Graphs
 
Introducing Ballerina
Introducing BallerinaIntroducing Ballerina
Introducing Ballerina
 

Semelhante a Tuning Java Servers

Scalable Apache for Beginners
Scalable Apache for BeginnersScalable Apache for Beginners
Scalable Apache for Beginnerswebhostingguy
 
Java Performance and Profiling
Java Performance and ProfilingJava Performance and Profiling
Java Performance and ProfilingWSO2
 
Interview questions
Interview questionsInterview questions
Interview questionsxavier john
 
Low level java programming
Low level java programmingLow level java programming
Low level java programmingPeter Lawrey
 
Sequential file programming patterns and performance with .net
Sequential  file programming patterns and performance with .netSequential  file programming patterns and performance with .net
Sequential file programming patterns and performance with .netMichael Pavlovsky
 
Tuning Solr and its Pipeline for Logs: Presented by Rafał Kuć & Radu Gheorghe...
Tuning Solr and its Pipeline for Logs: Presented by Rafał Kuć & Radu Gheorghe...Tuning Solr and its Pipeline for Logs: Presented by Rafał Kuć & Radu Gheorghe...
Tuning Solr and its Pipeline for Logs: Presented by Rafał Kuć & Radu Gheorghe...Lucidworks
 
Shorten Device Boot Time for Automotive IVI and Navigation Systems
Shorten Device Boot Time for Automotive IVI and Navigation SystemsShorten Device Boot Time for Automotive IVI and Navigation Systems
Shorten Device Boot Time for Automotive IVI and Navigation SystemsNational Cheng Kung University
 
How Many Slaves (Ukoug)
How Many Slaves (Ukoug)How Many Slaves (Ukoug)
How Many Slaves (Ukoug)Doug Burns
 
Low latency in java 8 v5
Low latency in java 8 v5Low latency in java 8 v5
Low latency in java 8 v5Peter Lawrey
 
Oracle Open World 2014: Lies, Damned Lies, and I/O Statistics [ CON3671]
Oracle Open World 2014: Lies, Damned Lies, and I/O Statistics [ CON3671]Oracle Open World 2014: Lies, Damned Lies, and I/O Statistics [ CON3671]
Oracle Open World 2014: Lies, Damned Lies, and I/O Statistics [ CON3671]Kyle Hailey
 
WE18_Performance_Up.ppt
WE18_Performance_Up.pptWE18_Performance_Up.ppt
WE18_Performance_Up.pptwebhostingguy
 
Oracle R12 EBS Performance Tuning
Oracle R12 EBS Performance TuningOracle R12 EBS Performance Tuning
Oracle R12 EBS Performance TuningScott Jenner
 
Cómo se diseña una base de datos que pueda ingerir más de cuatro millones de ...
Cómo se diseña una base de datos que pueda ingerir más de cuatro millones de ...Cómo se diseña una base de datos que pueda ingerir más de cuatro millones de ...
Cómo se diseña una base de datos que pueda ingerir más de cuatro millones de ...javier ramirez
 
Drupal Performance : DrupalCamp North
Drupal Performance : DrupalCamp NorthDrupal Performance : DrupalCamp North
Drupal Performance : DrupalCamp NorthPhilip Norton
 
Performance Analysis of Idle Programs
Performance Analysis of Idle ProgramsPerformance Analysis of Idle Programs
Performance Analysis of Idle Programsgreenwop
 
Zookeeper Introduce
Zookeeper IntroduceZookeeper Introduce
Zookeeper Introducejhao niu
 

Semelhante a Tuning Java Servers (20)

Scalable Apache for Beginners
Scalable Apache for BeginnersScalable Apache for Beginners
Scalable Apache for Beginners
 
Java Performance and Profiling
Java Performance and ProfilingJava Performance and Profiling
Java Performance and Profiling
 
Interview questions
Interview questionsInterview questions
Interview questions
 
Low level java programming
Low level java programmingLow level java programming
Low level java programming
 
Sequential file programming patterns and performance with .net
Sequential  file programming patterns and performance with .netSequential  file programming patterns and performance with .net
Sequential file programming patterns and performance with .net
 
Refining Linux
Refining LinuxRefining Linux
Refining Linux
 
Tuning Solr and its Pipeline for Logs: Presented by Rafał Kuć & Radu Gheorghe...
Tuning Solr and its Pipeline for Logs: Presented by Rafał Kuć & Radu Gheorghe...Tuning Solr and its Pipeline for Logs: Presented by Rafał Kuć & Radu Gheorghe...
Tuning Solr and its Pipeline for Logs: Presented by Rafał Kuć & Radu Gheorghe...
 
Tuning Solr & Pipeline for Logs
Tuning Solr & Pipeline for LogsTuning Solr & Pipeline for Logs
Tuning Solr & Pipeline for Logs
 
Fastest Servlets in the West
Fastest Servlets in the WestFastest Servlets in the West
Fastest Servlets in the West
 
Shorten Device Boot Time for Automotive IVI and Navigation Systems
Shorten Device Boot Time for Automotive IVI and Navigation SystemsShorten Device Boot Time for Automotive IVI and Navigation Systems
Shorten Device Boot Time for Automotive IVI and Navigation Systems
 
How Many Slaves (Ukoug)
How Many Slaves (Ukoug)How Many Slaves (Ukoug)
How Many Slaves (Ukoug)
 
Low latency in java 8 v5
Low latency in java 8 v5Low latency in java 8 v5
Low latency in java 8 v5
 
Oracle Open World 2014: Lies, Damned Lies, and I/O Statistics [ CON3671]
Oracle Open World 2014: Lies, Damned Lies, and I/O Statistics [ CON3671]Oracle Open World 2014: Lies, Damned Lies, and I/O Statistics [ CON3671]
Oracle Open World 2014: Lies, Damned Lies, and I/O Statistics [ CON3671]
 
WE18_Performance_Up.ppt
WE18_Performance_Up.pptWE18_Performance_Up.ppt
WE18_Performance_Up.ppt
 
Oracle R12 EBS Performance Tuning
Oracle R12 EBS Performance TuningOracle R12 EBS Performance Tuning
Oracle R12 EBS Performance Tuning
 
Cómo se diseña una base de datos que pueda ingerir más de cuatro millones de ...
Cómo se diseña una base de datos que pueda ingerir más de cuatro millones de ...Cómo se diseña una base de datos que pueda ingerir más de cuatro millones de ...
Cómo se diseña una base de datos que pueda ingerir más de cuatro millones de ...
 
Drupal Performance : DrupalCamp North
Drupal Performance : DrupalCamp NorthDrupal Performance : DrupalCamp North
Drupal Performance : DrupalCamp North
 
AEO Training - 2023.pdf
AEO Training - 2023.pdfAEO Training - 2023.pdf
AEO Training - 2023.pdf
 
Performance Analysis of Idle Programs
Performance Analysis of Idle ProgramsPerformance Analysis of Idle Programs
Performance Analysis of Idle Programs
 
Zookeeper Introduce
Zookeeper IntroduceZookeeper Introduce
Zookeeper Introduce
 

Mais de Srinath Perera

Book: Software Architecture and Decision-Making
Book: Software Architecture and Decision-MakingBook: Software Architecture and Decision-Making
Book: Software Architecture and Decision-MakingSrinath Perera
 
Data science Applications in the Enterprise
Data science Applications in the EnterpriseData science Applications in the Enterprise
Data science Applications in the EnterpriseSrinath Perera
 
An Introduction to APIs
An Introduction to APIs An Introduction to APIs
An Introduction to APIs Srinath Perera
 
An Introduction to Blockchain for Finance Professionals
An Introduction to Blockchain for Finance ProfessionalsAn Introduction to Blockchain for Finance Professionals
An Introduction to Blockchain for Finance ProfessionalsSrinath Perera
 
AI in the Real World: Challenges, and Risks and how to handle them?
AI in the Real World: Challenges, and Risks and how to handle them?AI in the Real World: Challenges, and Risks and how to handle them?
AI in the Real World: Challenges, and Risks and how to handle them?Srinath Perera
 
Healthcare + AI: Use cases & Challenges
Healthcare + AI: Use cases & ChallengesHealthcare + AI: Use cases & Challenges
Healthcare + AI: Use cases & ChallengesSrinath Perera
 
How would AI shape Future Integrations?
How would AI shape Future Integrations?How would AI shape Future Integrations?
How would AI shape Future Integrations?Srinath Perera
 
The Role of Blockchain in Future Integrations
The Role of Blockchain in Future IntegrationsThe Role of Blockchain in Future Integrations
The Role of Blockchain in Future IntegrationsSrinath Perera
 
Blockchain: Where are we? Where are we going?
Blockchain: Where are we? Where are we going? Blockchain: Where are we? Where are we going?
Blockchain: Where are we? Where are we going? Srinath Perera
 
Few thoughts about Future of Blockchain
Few thoughts about Future of BlockchainFew thoughts about Future of Blockchain
Few thoughts about Future of BlockchainSrinath Perera
 
A Visual Canvas for Judging New Technologies
A Visual Canvas for Judging New TechnologiesA Visual Canvas for Judging New Technologies
A Visual Canvas for Judging New TechnologiesSrinath Perera
 
Privacy in Bigdata Era
Privacy in Bigdata  EraPrivacy in Bigdata  Era
Privacy in Bigdata EraSrinath Perera
 
Blockchain, Impact, Challenges, and Risks
Blockchain, Impact, Challenges, and RisksBlockchain, Impact, Challenges, and Risks
Blockchain, Impact, Challenges, and RisksSrinath Perera
 
Today's Technology and Emerging Technology Landscape
Today's Technology and Emerging Technology LandscapeToday's Technology and Emerging Technology Landscape
Today's Technology and Emerging Technology LandscapeSrinath Perera
 
An Emerging Technologies Timeline
An Emerging Technologies TimelineAn Emerging Technologies Timeline
An Emerging Technologies TimelineSrinath Perera
 
The Rise of Streaming SQL and Evolution of Streaming Applications
The Rise of Streaming SQL and Evolution of Streaming ApplicationsThe Rise of Streaming SQL and Evolution of Streaming Applications
The Rise of Streaming SQL and Evolution of Streaming ApplicationsSrinath Perera
 
Analytics and AI: The Good, the Bad and the Ugly
Analytics and AI: The Good, the Bad and the UglyAnalytics and AI: The Good, the Bad and the Ugly
Analytics and AI: The Good, the Bad and the UglySrinath Perera
 
Transforming a Business Through Analytics
Transforming a Business Through AnalyticsTransforming a Business Through Analytics
Transforming a Business Through AnalyticsSrinath Perera
 
SoC Keynote:The State of the Art in Integration Technology
SoC Keynote:The State of the Art in Integration TechnologySoC Keynote:The State of the Art in Integration Technology
SoC Keynote:The State of the Art in Integration TechnologySrinath Perera
 

Mais de Srinath Perera (20)

Book: Software Architecture and Decision-Making
Book: Software Architecture and Decision-MakingBook: Software Architecture and Decision-Making
Book: Software Architecture and Decision-Making
 
Data science Applications in the Enterprise
Data science Applications in the EnterpriseData science Applications in the Enterprise
Data science Applications in the Enterprise
 
An Introduction to APIs
An Introduction to APIs An Introduction to APIs
An Introduction to APIs
 
An Introduction to Blockchain for Finance Professionals
An Introduction to Blockchain for Finance ProfessionalsAn Introduction to Blockchain for Finance Professionals
An Introduction to Blockchain for Finance Professionals
 
AI in the Real World: Challenges, and Risks and how to handle them?
AI in the Real World: Challenges, and Risks and how to handle them?AI in the Real World: Challenges, and Risks and how to handle them?
AI in the Real World: Challenges, and Risks and how to handle them?
 
Healthcare + AI: Use cases & Challenges
Healthcare + AI: Use cases & ChallengesHealthcare + AI: Use cases & Challenges
Healthcare + AI: Use cases & Challenges
 
How would AI shape Future Integrations?
How would AI shape Future Integrations?How would AI shape Future Integrations?
How would AI shape Future Integrations?
 
The Role of Blockchain in Future Integrations
The Role of Blockchain in Future IntegrationsThe Role of Blockchain in Future Integrations
The Role of Blockchain in Future Integrations
 
Future of Serverless
Future of ServerlessFuture of Serverless
Future of Serverless
 
Blockchain: Where are we? Where are we going?
Blockchain: Where are we? Where are we going? Blockchain: Where are we? Where are we going?
Blockchain: Where are we? Where are we going?
 
Few thoughts about Future of Blockchain
Few thoughts about Future of BlockchainFew thoughts about Future of Blockchain
Few thoughts about Future of Blockchain
 
A Visual Canvas for Judging New Technologies
A Visual Canvas for Judging New TechnologiesA Visual Canvas for Judging New Technologies
A Visual Canvas for Judging New Technologies
 
Privacy in Bigdata Era
Privacy in Bigdata  EraPrivacy in Bigdata  Era
Privacy in Bigdata Era
 
Blockchain, Impact, Challenges, and Risks
Blockchain, Impact, Challenges, and RisksBlockchain, Impact, Challenges, and Risks
Blockchain, Impact, Challenges, and Risks
 
Today's Technology and Emerging Technology Landscape
Today's Technology and Emerging Technology LandscapeToday's Technology and Emerging Technology Landscape
Today's Technology and Emerging Technology Landscape
 
An Emerging Technologies Timeline
An Emerging Technologies TimelineAn Emerging Technologies Timeline
An Emerging Technologies Timeline
 
The Rise of Streaming SQL and Evolution of Streaming Applications
The Rise of Streaming SQL and Evolution of Streaming ApplicationsThe Rise of Streaming SQL and Evolution of Streaming Applications
The Rise of Streaming SQL and Evolution of Streaming Applications
 
Analytics and AI: The Good, the Bad and the Ugly
Analytics and AI: The Good, the Bad and the UglyAnalytics and AI: The Good, the Bad and the Ugly
Analytics and AI: The Good, the Bad and the Ugly
 
Transforming a Business Through Analytics
Transforming a Business Through AnalyticsTransforming a Business Through Analytics
Transforming a Business Through Analytics
 
SoC Keynote:The State of the Art in Integration Technology
SoC Keynote:The State of the Art in Integration TechnologySoC Keynote:The State of the Art in Integration Technology
SoC Keynote:The State of the Art in Integration Technology
 

Último

A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxBUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxalwaysnagaraju26
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdfPearlKirahMaeRagusta1
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park masabamasaba
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfayushiqss
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is insideshinachiaurasa2
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech studentsHimanshiGarg82
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfVishalKumarJha10
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfryanfarris8
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...Nitya salvi
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...SelfMade bd
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...kalichargn70th171
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfkalichargn70th171
 
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verifiedSector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verifiedDelhi Call girls
 

Último (20)

A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxBUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verifiedSector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 

Tuning Java Servers

  • 2. Outline  With size of systems growing, Performance become increasingly critical for both R&D as well as support o Less performance => more machines => lot of Devops costs and potential for failures  We will do o Bit of Theory o Then to Profiling  Will discuss different profiling views, and most importantly when to use them.
  • 5. What is Performance Tuning?  Get maximum out of the machine o Max Throughput o Min Latency  Often this become a tradeoff, so you need a balance o General case is to get max throughput within given latency limits. (E.g. max throughput with latency less than 100ms.)
  • 6. Lets understand what they are  What is throughput? o Number of messages server can process per second o Measured as the number of messages processed/ time to process messages  What is latency? o End to end time for a server to process an message  We discuss performance as relationship between three variables: latency, concurrency, throughput
  • 7. What Limits Performance?  Lack of resources  Bottleneck – most scarce resource decides the performance o CPU bound o Disk bound o Bandwidth bound o Latency bound o Memory bound
  • 8. Performance and Bottlenecks  Think of performance as a water pipe system  Bottle neck decides overall throughput  Latency problems often caused at the same bottlenecks due to contention  Potential Bottlenecks (Resources) o CPU o Disk o Network o Memory - Available Memory - Heap Size - GC (Java) – will eat in CPU
  • 10. Little’s Law  Bound your queue’s (reject too much requests to give better response time)
  • 12.
  • 13. Performance Numbers (based on Jeff Dean’s numbers ) Latency / time for 1 memory Op If Memory access is a Second L1 cache reference 0.05 1/20th sec Main memory reference 1 1 sec Send 2K bytes over 1 Gbps network 200 3 min Read 1 MB sequentially from memory 2500 41 min Disk seek 1*10^5 27 hours Read 1 MB sequentially from disk 2*10^5 2 days Send packet CA->Netherlands->CA 1.5*10^6 17 days See http://tapestryjava.blogspot.com/2012/06/latency-numbers-every- programmer-should.html
  • 14. Performance Numbers (based on Jeff Dean’s numbers ) Latency / time for 1 memory Op If Memory access is a Second L1 cache reference 0.05 1/20th sec Main memory reference 1 1 sec Send 2K bytes over 1 Gbps network 200 3 min Read 1 MB sequentially from memory 2500 41 min Disk seek 1*10^5 27 hours Read 1 MB sequentially from disk 2*10^5 2 days Send packet CA->Netherlands->CA 1.5*10^6 17 days See http://tapestryjava.blogspot.com/2012/06/latency-numbers-every- programmer-should.html
  • 15. Latency Lags Bandwidth  Observation in prof. Patterson’s Keynote at 2004  Bandwidth improves, but not latency  Same holds now, and the gap is widening with new systems
  • 16. Handling Speed Differences in Memory Hierarchy 1. Caching o E.g. Processor caches, file cache, disk cache, permission cache 2. Replication o E.g. RAID, Content Distribution Networks (CDN), Web Cache 3. Prediction – Predict what data will be needed and prefect o Tradeoff bandwidth o E.g. disk caches, Google Earth
  • 17. Potential Performance Problems  Low performance o Low Throughput o High latency  Memory leaks  File, Thread, Connection Leaks
  • 18. Warning  Many think performance is due to CPU  People forget network and Disk (most our workloads are network bound) o That’s why CPU 10% but machine is loaded (load average 40)  Need to look at all  First step is find the bottleneck
  • 19. Where to start? Load Average  Most start by looking at CPU usage  That does not reflect non-CPU load  Load average is much better o Represent the size of the process queue o Can found via top (1m, 5m, 15m) o Goes high when CPU, network, disk, memory etc., are limited o Normal value = number of cores, 4X number of cores means high o 10X core size means machine is unusable Read • http://prutser.wordpress.com/2012/04/23/understanding-linux-load-average- part-1/ also part2 and part 3
  • 20. Profiling Tools  First step is connect through JConsole, and get basic idea.  Also monitor the load average, CPU usage, and IO operations (via top or Sar)  Then you can switch to tools like JProfiler, Yourkit, Java Flight Recorder  Important views o CPU views (bottlenecks) o Thread views and monitor views o Memory views (GC, allocations, and memory leaks) o IO and JDBC tracing
  • 21. Top
  • 23. Java Flight Recorder  Former Oracle Jrocket Mission control  Now included with JDK 7 update 44+  Nice tool, very fast, you could run it in production  Can start via $JAVA_HOME/bin/jmc  Profiling JVM need to have following java option at start o -XX:+UnlockCommercialFeatures -XX:+FlightRecorder
  • 24.
  • 25. Hands On  Code and scripts from https://github.com/srinathperera/JavaProfilingTalk  Run ant to build the service  Download and unzip WSO2 AS. Run wso2server.sh to start  Go to http:// 127.0.0.1:9443/carbon and login via admin/ admin  Deploy the aar by going to Services->Add->AAR Service  Download jmeter, unzip, and run bin/jmeter  Run Jmeter scripts to recreate performance problems
  • 26. Get started with JProfiler  Download install – work with linux, windows, and Mac  New Session, then configure o Same Machine connect o Remote connect - Java - agentpath:/Applications/jprofiler7/bin/macos/libjprofil erti.jnilib=port=8849 o Offline profile  Adjust filters to org.wos2, org.apache, java.util. and remove excludes (can change this)  Connect
  • 27. JProfiler  Instrumentation vs. Sampling  Jpenable let you connect to an running server remotely
  • 28. Problem 1: Tuning for Throughput  Is machine loaded (checked via load average)? o If you are putting small load, throughout will be less  Try increasing concurrency (load)
  • 29. Problem 1: Tuning for.. (Contd)  If load average low o Check lock profile o Try tuning threads - If server set to small number of threads, that will limit performance o Ensure network not saturated - Try transfer a large file
  • 30. Problem 1: Tuning for.. (Contd)  If high load average o Is machine loaded by something else? o Check CPU (top) - If high check CPU profile - If GC percentage > 10% tune GC o Check network o Check Disk o Check is Machine paging
  • 32. CPU Profile  First check hotspots  Then call tree o show inherent time as oppose to cumulative time (Call graph)  Make sure what takes CPU is where real work is done  CPU1 and CPU2 samples
  • 33. Network/ Disk Profile  Enable Socket or Servlet (or Files) via Probes  Hotspots  Read/Write via telematics  Samples tooManyIOPSCall.jmx tooManyNetowrkCalls.jmx
  • 34. Lock Profile  Threads view (History and telemetric view)  Monitor view  bockedThreadsCall.jmx sample
  • 35. Problem 2: Tuning for Latency  Look for bottlenecks – same causes add latency due to queuing o Try to find any queue are growing  Check thread views and lock views o As discussed in Lock profile  All IO (both disk and network) are expensive o Network and Disk Profiles  How to find? o Call Graph o Put system outs and check
  • 36. Problem 3: Finding Memory Leaks  Use Eclipse Memory Analyzer  Go to JProfiler if it is hard to pin down  Support mark and monitoring memory in running system  Can also analyze a memory dump o Select the objects o Checking incoming references (cumulative) o Reference Graph can also help
  • 37. Eclipse Memory Analyzer  When OOM, WSO2 servers create a dump  Open with eclipse memory analyzer
  • 38. Memory leaks with Jprofiler
  • 39. Allocation view  Use to find where objects are created
  • 40. GC Tuning  If time spent on GC > 10%, then should tune GC  “gc overhead limit exceeded” – means > 90% time spent on GC
  • 41. GC Tuning  If time spent on GC > 10%, then should tune GC  “gc overhead limit exceeded” – means > 90% time spent on GC  Consider using allocation views to reduce objects created
  • 42. Problem 4: Finding Thread Leaks  Check the number of threads in thread graph  Check which thread are created  Thread dumps o jstack <pid> >> threaddumps.log o Jprofiler can get thread dumps as well  Take thread dumps at different times
  • 44. Problem 3: Connection Leaks  Exhausted pools, file descriptor limits  Check at finally points and in catch clauses
  • 45. Tuning without an GUI  Create a JProfile session and configure the triggers. o Need Periodic triggers Copy local .jprofiler7/config.xml and JProfiler binaries or agent code to the remote machine  Add following before the java command. o - agentpath:JPROF_LOCATION/bin/macos/libjprofilerti.jnilib=offline,id=S ESSION_ID,config=/Users/srinath/.jprofiler7/config.xml  Here replace the configuration file and JProfiler location with your machine's values. o SESSION_ID is the session ID of the session you created with JProfiler UI. Here ~./jprofiler7/config.xml file has settings for all sessions creates by jprofiler, and it will pick up the right value. If you are profiling in a remote machine copy your local configs to the remote host.  Start and run the program, and it will print the following  JProfiler> Using JVMTI  ..  Open the snapshot file and analyze using JProfiler UI.
  • 46. Tuning  OS Level Tuning o For example, http://www.lognormal.com/blog/2012/09/27/linu x-tcpip-tuning/ o Generally available with the product o It depends on OS etc.  Product Tuning o Thread pools sizes mainly, there may be others  Application Tuning o This is your application, you need to profile
  • 47. Conclusion  Know the goals  Find where the bottleneck using Load average and other OS tools  Zoom in using profiler  Know profile views and when to use them  Details are important, so is the big picture  Think .. Think ..
  • 48. References  Responding in a Timely Manner, https://www.youtube.com/watch?v=q_DCipkM sy0  Tuning Java Servers - http://www.infoq.com/articles/Tuning-Java- Servers  Thinking Clearly about Performance, http://queue.acm.org/detail.cfm?id=1854041# content-comments