SlideShare une entreprise Scribd logo
1  sur  30
Télécharger pour lire hors ligne
Application Profiling
          for
Memory & Performance
Srinath Perera   Pradeep Fernando   Dinuka Malalanayke
  WSO2 Inc           WSO2 Inc           WSO2 Inc
Understanding Server Performance
When Concurrency Increases?


•   Throughput increases, but where will it stop?
•   When there are contention for the server
•   Contention for what?
    o   CPU
    o   Memory
    o   Disk - I/O
    o   Network -I/O
•   If your server running on full capacity, there should be at
    least one resource under contention.
How to measure Contention?


•   CPU - CPU or load average
•   Memory - GC logs, monitor memory, sometime swapping
•   Disk I/O - IOPS per seconds, load average
•   Network I/O - network utilization, load average
•   What is load average? length of processor queue of the OS
•   How much load average is too much?
    o   Load average = number of cores (machine is fully used)
    o   Load average = 2* number of cores (machine is loaded)
If you cannot find contention

•   Either load is too small
•   You have too much locks. Look for lock profile
•   Server might be processing with too less threads (IO and
    CPU thread switches)
Performance Tuning


•   Increase throughput/ latency or both
•   Know that latency vs. throughput is often a tradeoff
•   Run the system and see how it does, make sure you are
    putting in enough load
•   Verify where is the bottleneck? is it CPU, memory, network,
    or disk
•   Start tuning
Tuning



•   When you tune, bottlenecks will shift, you will have to shift
    your focus
•   Can you tune settings (Application, JVM, OS) to improve and
    shift the bottleneck? play with parameters .. we call this
    parameter sweep
•   Then focus on the code, look for right profile
    o   CPU profile
    o   Memory/ Allocation profile
    o   Network profile
    o   IO profile
    o   Database profile
Programmer Nightmares
Programmer Nightmares



                  ClassCastException
                        Permgen Errors
            DeadLocks
                           NullPointer
     Unacceptable Latency
     CPU spin       OutofMemoryException
            ArrayIndexOutOfBoundsException

[image] http://www1.free-clipart.net/gallery2/clipart/Holidays/Halloween/Ghost_-_Boo.jpg
Introducing: Profiling...



•   Best thing would be to write bug free, high performant code
•   Normally development happens in iterative manner - get
    something to work and improve on that.
•   Basic profiling can help you to eliminate most of the memory
    and performance issues.
Right Tools...


•       There are many commercial and open source tools
•       We are going to use,
         o       Jprofiler by ejTechnologies
                     CPU, Memory, Allocation, Network, DB
         o       Eclipse Memory Analyzer tool
                     Find memory leaks
         o       Standard JDK tooling - Jconsole
                     Basic stats




    [image] http://writingsongs.com/pictures/toolbox.jpg
Environment Setup
    With WSO2 Carbon
Setting up JProfiler

•   Profiling modes local/remote
•   Applying common filters for WSO2 products
•   Different views..
JProfiler Contd.


CPU view
 - Call trees, Hot spots
Memory view
 - Allocation Hot spots, Recorded objects, Heap walker
VM telemetry view
 - Memory, Threads status graphs
Probes
  - JDBC , Sockets
JConsole


•   Connect to the running instance local/remote
•   Different memory banks
•   Getting most out of Mbeans.
•   Getting a memory dump and analyzing with Eclipse MAT.
•   Remote JMX URL gets printed in the console during server
    startup:

       JMX Service URL : service:jmx:rmi://localhost:11111/jndi/rmi://localhost:9999/jmxrmi
       username : admin password : admin
JConsole
Memory Analyzer Tool


•   Analyze heap dumps.
•   Identifying OOM issues are trivial with basic leak report.
Usual Suspects

 Some of the common issues...
Permgen Errors


•   Permgen space relates to the 'Programme code' part, a.k.a -
    Loaded classes.
•   ClassLoader leaks
•   Typically happens in Container environments
•   Can uncover by doing deploy/redeploy cycles.
•   If one of the application objects get referenced by an object,
    outside the application, permgen error waiting to happen.
Permgen Errors



Container

                  URLClassLoader             Application




                                      Application Objects
    Container provided
         Objects
Memory Leaks - OOM


•   Languages like C, gave the control of memory to the
    programmer.
•   Java is a managed memory, language.
•   Still the JVM can't free up the memory, if the application is
    holding on to the objects.
•   Unnecessary accumulation of objects,
    o   Object creation for each and every connection
    o   Slow output rate in the input/output system
    o   Collecting clusterwide messages without an upper bound.
DeadLocks



                          Resource A




                          Resource B




•   Re-designing the lock acquiring sequence
•   Using LockManagers that keeps track of lock acquisition
Liveness issues...




•   Starvation - A thread can starve for CPU cycles, if it is
    blocked by a lock-wait.
•   Poor Responsiveness
•   LiveLock scenarios
Programming Best Practices



•   Think about memory aspects/ data retrieval process while
    writing code.
•   Optimize the critical Path (look at CPU profile).
•   Make use of Standard libs as much as possible.
•   Profile your apps before releasing them to production.
WSO2 make use of profiling ?
Identity Server - Losing weight




• Carbon server optimized to run in constrained memory
  environment.
• No front end components - 'createWorker' ant task.
• Selective Admin service loading. -Doptimized=true
• Removed unwanted functionality based on the use-case,
  (p2 - provisioning, etc)
Raspberry-Pi Clusters



   •   Application server
       cluster running on R-
       Pis.
   •   Powering the
       WSO2Con 2013
       mobile app
   •   512MB of RAM and
       ARM processor.
Demo

CPU spin and Memory leak scenario
Questions
Thank You

Contenu connexe

Tendances

Ninja Build: Simple Guide for Beginners
Ninja Build: Simple Guide for BeginnersNinja Build: Simple Guide for Beginners
Ninja Build: Simple Guide for BeginnersChang W. Doh
 
C# as a System Language
C# as a System LanguageC# as a System Language
C# as a System LanguageScyllaDB
 
Non blocking io with netty
Non blocking io with nettyNon blocking io with netty
Non blocking io with nettyZauber
 
Under the Hood of a Shard-per-Core Database Architecture
Under the Hood of a Shard-per-Core Database ArchitectureUnder the Hood of a Shard-per-Core Database Architecture
Under the Hood of a Shard-per-Core Database ArchitectureScyllaDB
 
인프콘 2022 - Rust 크로스 플랫폼 프로그래밍
인프콘 2022 - Rust 크로스 플랫폼 프로그래밍인프콘 2022 - Rust 크로스 플랫폼 프로그래밍
인프콘 2022 - Rust 크로스 플랫폼 프로그래밍Chris Ohk
 
ELC-E 2010: The Right Approach to Minimal Boot Times
ELC-E 2010: The Right Approach to Minimal Boot TimesELC-E 2010: The Right Approach to Minimal Boot Times
ELC-E 2010: The Right Approach to Minimal Boot Timesandrewmurraympc
 
USENIX ATC 2017: Visualizing Performance with Flame Graphs
USENIX ATC 2017: Visualizing Performance with Flame GraphsUSENIX ATC 2017: Visualizing Performance with Flame Graphs
USENIX ATC 2017: Visualizing Performance with Flame GraphsBrendan Gregg
 
Spring One 2 GX 2014 - CACHING WITH SPRING: ADVANCED TOPICS AND BEST PRACTICES
Spring One 2 GX 2014 - CACHING WITH SPRING: ADVANCED TOPICS AND BEST PRACTICESSpring One 2 GX 2014 - CACHING WITH SPRING: ADVANCED TOPICS AND BEST PRACTICES
Spring One 2 GX 2014 - CACHING WITH SPRING: ADVANCED TOPICS AND BEST PRACTICESMichael Plöd
 
NGINX Installation and Tuning
NGINX Installation and TuningNGINX Installation and Tuning
NGINX Installation and TuningNGINX, Inc.
 
Spring Security Patterns
Spring Security PatternsSpring Security Patterns
Spring Security PatternsVMware Tanzu
 
Yet another introduction to Linux RCU
Yet another introduction to Linux RCUYet another introduction to Linux RCU
Yet another introduction to Linux RCUViller Hsiao
 
The Integration of Laravel with Swoole
The Integration of Laravel with SwooleThe Integration of Laravel with Swoole
The Integration of Laravel with SwooleAlbert Chen
 
예외처리가이드
예외처리가이드예외처리가이드
예외처리가이드도형 임
 
Twitter의 snowflake 소개 및 활용
Twitter의 snowflake 소개 및 활용Twitter의 snowflake 소개 및 활용
Twitter의 snowflake 소개 및 활용흥배 최
 
Producer Performance Tuning for Apache Kafka
Producer Performance Tuning for Apache KafkaProducer Performance Tuning for Apache Kafka
Producer Performance Tuning for Apache KafkaJiangjie Qin
 
Quartz to Implement Scheduling Service
Quartz to Implement Scheduling ServiceQuartz to Implement Scheduling Service
Quartz to Implement Scheduling ServiceAkila Senevirathne
 
Static PIE, How and Why - Metasploit's new POSIX payload: Mettle
Static PIE, How and Why - Metasploit's new POSIX payload: MettleStatic PIE, How and Why - Metasploit's new POSIX payload: Mettle
Static PIE, How and Why - Metasploit's new POSIX payload: MettleBrent Cook
 

Tendances (20)

Ninja Build: Simple Guide for Beginners
Ninja Build: Simple Guide for BeginnersNinja Build: Simple Guide for Beginners
Ninja Build: Simple Guide for Beginners
 
C# as a System Language
C# as a System LanguageC# as a System Language
C# as a System Language
 
Non blocking io with netty
Non blocking io with nettyNon blocking io with netty
Non blocking io with netty
 
Under the Hood of a Shard-per-Core Database Architecture
Under the Hood of a Shard-per-Core Database ArchitectureUnder the Hood of a Shard-per-Core Database Architecture
Under the Hood of a Shard-per-Core Database Architecture
 
인프콘 2022 - Rust 크로스 플랫폼 프로그래밍
인프콘 2022 - Rust 크로스 플랫폼 프로그래밍인프콘 2022 - Rust 크로스 플랫폼 프로그래밍
인프콘 2022 - Rust 크로스 플랫폼 프로그래밍
 
ELC-E 2010: The Right Approach to Minimal Boot Times
ELC-E 2010: The Right Approach to Minimal Boot TimesELC-E 2010: The Right Approach to Minimal Boot Times
ELC-E 2010: The Right Approach to Minimal Boot Times
 
USENIX ATC 2017: Visualizing Performance with Flame Graphs
USENIX ATC 2017: Visualizing Performance with Flame GraphsUSENIX ATC 2017: Visualizing Performance with Flame Graphs
USENIX ATC 2017: Visualizing Performance with Flame Graphs
 
Spring One 2 GX 2014 - CACHING WITH SPRING: ADVANCED TOPICS AND BEST PRACTICES
Spring One 2 GX 2014 - CACHING WITH SPRING: ADVANCED TOPICS AND BEST PRACTICESSpring One 2 GX 2014 - CACHING WITH SPRING: ADVANCED TOPICS AND BEST PRACTICES
Spring One 2 GX 2014 - CACHING WITH SPRING: ADVANCED TOPICS AND BEST PRACTICES
 
NGINX Installation and Tuning
NGINX Installation and TuningNGINX Installation and Tuning
NGINX Installation and Tuning
 
Spring Security Patterns
Spring Security PatternsSpring Security Patterns
Spring Security Patterns
 
Tuned
TunedTuned
Tuned
 
Yet another introduction to Linux RCU
Yet another introduction to Linux RCUYet another introduction to Linux RCU
Yet another introduction to Linux RCU
 
The Integration of Laravel with Swoole
The Integration of Laravel with SwooleThe Integration of Laravel with Swoole
The Integration of Laravel with Swoole
 
The basics of fluentd
The basics of fluentdThe basics of fluentd
The basics of fluentd
 
예외처리가이드
예외처리가이드예외처리가이드
예외처리가이드
 
Introduction to Linux Drivers
Introduction to Linux DriversIntroduction to Linux Drivers
Introduction to Linux Drivers
 
Twitter의 snowflake 소개 및 활용
Twitter의 snowflake 소개 및 활용Twitter의 snowflake 소개 및 활용
Twitter의 snowflake 소개 및 활용
 
Producer Performance Tuning for Apache Kafka
Producer Performance Tuning for Apache KafkaProducer Performance Tuning for Apache Kafka
Producer Performance Tuning for Apache Kafka
 
Quartz to Implement Scheduling Service
Quartz to Implement Scheduling ServiceQuartz to Implement Scheduling Service
Quartz to Implement Scheduling Service
 
Static PIE, How and Why - Metasploit's new POSIX payload: Mettle
Static PIE, How and Why - Metasploit's new POSIX payload: MettleStatic PIE, How and Why - Metasploit's new POSIX payload: Mettle
Static PIE, How and Why - Metasploit's new POSIX payload: Mettle
 

Similaire à Application Profiling for Memory and Performance

Application Profiling for Memory and Performance
Application Profiling for Memory and PerformanceApplication Profiling for Memory and Performance
Application Profiling for Memory and PerformanceWSO2
 
Deployment Strategy
Deployment StrategyDeployment Strategy
Deployment StrategyMongoDB
 
Deployment Strategies
Deployment StrategiesDeployment Strategies
Deployment StrategiesMongoDB
 
Deployment Strategies (Mongo Austin)
Deployment Strategies (Mongo Austin)Deployment Strategies (Mongo Austin)
Deployment Strategies (Mongo Austin)MongoDB
 
Experiences with Debugging Data Races
Experiences with Debugging Data RacesExperiences with Debugging Data Races
Experiences with Debugging Data RacesAzul Systems Inc.
 
Using the big guns: Advanced OS performance tools for troubleshooting databas...
Using the big guns: Advanced OS performance tools for troubleshooting databas...Using the big guns: Advanced OS performance tools for troubleshooting databas...
Using the big guns: Advanced OS performance tools for troubleshooting databas...Nikolay Savvinov
 
NSC #2 - D3 02 - Peter Hlavaty - Attack on the Core
NSC #2 - D3 02 - Peter Hlavaty - Attack on the CoreNSC #2 - D3 02 - Peter Hlavaty - Attack on the Core
NSC #2 - D3 02 - Peter Hlavaty - Attack on the CoreNoSuchCon
 
Computer system organization
Computer system organizationComputer system organization
Computer system organizationSyed Zaid Irshad
 
Machine Learning With H2O vs SparkML
Machine Learning With H2O vs SparkMLMachine Learning With H2O vs SparkML
Machine Learning With H2O vs SparkMLArnab Biswas
 
"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)
"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)
"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)Tech in Asia ID
 
Compilers and interpreters
Compilers and interpretersCompilers and interpreters
Compilers and interpretersRAJU KATHI
 
Java troubleshooting thread dump
Java troubleshooting thread dumpJava troubleshooting thread dump
Java troubleshooting thread dumpejlp12
 
TechGIG_Memory leaks in_java_webnair_26th_july_2012
TechGIG_Memory leaks in_java_webnair_26th_july_2012TechGIG_Memory leaks in_java_webnair_26th_july_2012
TechGIG_Memory leaks in_java_webnair_26th_july_2012Ashish Bhasin
 
Oracle WebLogic Diagnostics & Perfomance tuning
Oracle WebLogic Diagnostics & Perfomance tuningOracle WebLogic Diagnostics & Perfomance tuning
Oracle WebLogic Diagnostics & Perfomance tuningMichel Schildmeijer
 
Web Sphere Problem Determination Ext
Web Sphere Problem Determination ExtWeb Sphere Problem Determination Ext
Web Sphere Problem Determination ExtRohit Kelapure
 
Azug - successfully breeding rabits
Azug - successfully breeding rabitsAzug - successfully breeding rabits
Azug - successfully breeding rabitsYves Goeleven
 

Similaire à Application Profiling for Memory and Performance (20)

Application Profiling for Memory and Performance
Application Profiling for Memory and PerformanceApplication Profiling for Memory and Performance
Application Profiling for Memory and Performance
 
Attack on the Core
Attack on the CoreAttack on the Core
Attack on the Core
 
Deployment Strategy
Deployment StrategyDeployment Strategy
Deployment Strategy
 
Deployment
DeploymentDeployment
Deployment
 
Deployment Strategies
Deployment StrategiesDeployment Strategies
Deployment Strategies
 
Deployment Strategies (Mongo Austin)
Deployment Strategies (Mongo Austin)Deployment Strategies (Mongo Austin)
Deployment Strategies (Mongo Austin)
 
Experiences with Debugging Data Races
Experiences with Debugging Data RacesExperiences with Debugging Data Races
Experiences with Debugging Data Races
 
Using the big guns: Advanced OS performance tools for troubleshooting databas...
Using the big guns: Advanced OS performance tools for troubleshooting databas...Using the big guns: Advanced OS performance tools for troubleshooting databas...
Using the big guns: Advanced OS performance tools for troubleshooting databas...
 
Fastest Servlets in the West
Fastest Servlets in the WestFastest Servlets in the West
Fastest Servlets in the West
 
NSC #2 - D3 02 - Peter Hlavaty - Attack on the Core
NSC #2 - D3 02 - Peter Hlavaty - Attack on the CoreNSC #2 - D3 02 - Peter Hlavaty - Attack on the Core
NSC #2 - D3 02 - Peter Hlavaty - Attack on the Core
 
Computer system organization
Computer system organizationComputer system organization
Computer system organization
 
Machine Learning With H2O vs SparkML
Machine Learning With H2O vs SparkMLMachine Learning With H2O vs SparkML
Machine Learning With H2O vs SparkML
 
"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)
"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)
"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)
 
Spark Tips & Tricks
Spark Tips & TricksSpark Tips & Tricks
Spark Tips & Tricks
 
Compilers and interpreters
Compilers and interpretersCompilers and interpreters
Compilers and interpreters
 
Java troubleshooting thread dump
Java troubleshooting thread dumpJava troubleshooting thread dump
Java troubleshooting thread dump
 
TechGIG_Memory leaks in_java_webnair_26th_july_2012
TechGIG_Memory leaks in_java_webnair_26th_july_2012TechGIG_Memory leaks in_java_webnair_26th_july_2012
TechGIG_Memory leaks in_java_webnair_26th_july_2012
 
Oracle WebLogic Diagnostics & Perfomance tuning
Oracle WebLogic Diagnostics & Perfomance tuningOracle WebLogic Diagnostics & Perfomance tuning
Oracle WebLogic Diagnostics & Perfomance tuning
 
Web Sphere Problem Determination Ext
Web Sphere Problem Determination ExtWeb Sphere Problem Determination Ext
Web Sphere Problem Determination Ext
 
Azug - successfully breeding rabits
Azug - successfully breeding rabitsAzug - successfully breeding rabits
Azug - successfully breeding rabits
 

Dernier

COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaborationbruanjhuli
 
VoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXVoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXTarek Kalaji
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...Aggregage
 
COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Websitedgelyza
 
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAshyamraj55
 
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesAI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesMd Hossain Ali
 
NIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopNIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopBachir Benyammi
 
OpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureOpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureEric D. Schabell
 
Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024SkyPlanner
 
How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?IES VE
 
Introduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxIntroduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxMatsuo Lab
 
20230202 - Introduction to tis-py
20230202 - Introduction to tis-py20230202 - Introduction to tis-py
20230202 - Introduction to tis-pyJamie (Taka) Wang
 
Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Brian Pichman
 
Designing A Time bound resource download URL
Designing A Time bound resource download URLDesigning A Time bound resource download URL
Designing A Time bound resource download URLRuncy Oommen
 
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...DianaGray10
 
Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfinfogdgmi
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7DianaGray10
 
Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1DianaGray10
 
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Will Schroeder
 
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsIgniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsSafe Software
 

Dernier (20)

COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
 
VoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXVoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBX
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
 
COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Website
 
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
 
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesAI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
 
NIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopNIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 Workshop
 
OpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureOpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability Adventure
 
Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024
 
How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?
 
Introduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxIntroduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptx
 
20230202 - Introduction to tis-py
20230202 - Introduction to tis-py20230202 - Introduction to tis-py
20230202 - Introduction to tis-py
 
Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )
 
Designing A Time bound resource download URL
Designing A Time bound resource download URLDesigning A Time bound resource download URL
Designing A Time bound resource download URL
 
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
 
Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdf
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7
 
Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1
 
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
 
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsIgniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
 

Application Profiling for Memory and Performance

  • 1. Application Profiling for Memory & Performance Srinath Perera Pradeep Fernando Dinuka Malalanayke WSO2 Inc WSO2 Inc WSO2 Inc
  • 3. When Concurrency Increases? • Throughput increases, but where will it stop? • When there are contention for the server • Contention for what? o CPU o Memory o Disk - I/O o Network -I/O • If your server running on full capacity, there should be at least one resource under contention.
  • 4. How to measure Contention? • CPU - CPU or load average • Memory - GC logs, monitor memory, sometime swapping • Disk I/O - IOPS per seconds, load average • Network I/O - network utilization, load average • What is load average? length of processor queue of the OS • How much load average is too much? o Load average = number of cores (machine is fully used) o Load average = 2* number of cores (machine is loaded)
  • 5. If you cannot find contention • Either load is too small • You have too much locks. Look for lock profile • Server might be processing with too less threads (IO and CPU thread switches)
  • 6. Performance Tuning • Increase throughput/ latency or both • Know that latency vs. throughput is often a tradeoff • Run the system and see how it does, make sure you are putting in enough load • Verify where is the bottleneck? is it CPU, memory, network, or disk • Start tuning
  • 7. Tuning • When you tune, bottlenecks will shift, you will have to shift your focus • Can you tune settings (Application, JVM, OS) to improve and shift the bottleneck? play with parameters .. we call this parameter sweep • Then focus on the code, look for right profile o CPU profile o Memory/ Allocation profile o Network profile o IO profile o Database profile
  • 9. Programmer Nightmares ClassCastException Permgen Errors DeadLocks NullPointer Unacceptable Latency CPU spin OutofMemoryException ArrayIndexOutOfBoundsException [image] http://www1.free-clipart.net/gallery2/clipart/Holidays/Halloween/Ghost_-_Boo.jpg
  • 10. Introducing: Profiling... • Best thing would be to write bug free, high performant code • Normally development happens in iterative manner - get something to work and improve on that. • Basic profiling can help you to eliminate most of the memory and performance issues.
  • 11. Right Tools... • There are many commercial and open source tools • We are going to use, o Jprofiler by ejTechnologies  CPU, Memory, Allocation, Network, DB o Eclipse Memory Analyzer tool  Find memory leaks o Standard JDK tooling - Jconsole  Basic stats [image] http://writingsongs.com/pictures/toolbox.jpg
  • 12. Environment Setup With WSO2 Carbon
  • 13. Setting up JProfiler • Profiling modes local/remote • Applying common filters for WSO2 products • Different views..
  • 14. JProfiler Contd. CPU view - Call trees, Hot spots Memory view - Allocation Hot spots, Recorded objects, Heap walker VM telemetry view - Memory, Threads status graphs Probes - JDBC , Sockets
  • 15. JConsole • Connect to the running instance local/remote • Different memory banks • Getting most out of Mbeans. • Getting a memory dump and analyzing with Eclipse MAT. • Remote JMX URL gets printed in the console during server startup: JMX Service URL : service:jmx:rmi://localhost:11111/jndi/rmi://localhost:9999/jmxrmi username : admin password : admin
  • 17. Memory Analyzer Tool • Analyze heap dumps. • Identifying OOM issues are trivial with basic leak report.
  • 18. Usual Suspects Some of the common issues...
  • 19. Permgen Errors • Permgen space relates to the 'Programme code' part, a.k.a - Loaded classes. • ClassLoader leaks • Typically happens in Container environments • Can uncover by doing deploy/redeploy cycles. • If one of the application objects get referenced by an object, outside the application, permgen error waiting to happen.
  • 20. Permgen Errors Container URLClassLoader Application Application Objects Container provided Objects
  • 21. Memory Leaks - OOM • Languages like C, gave the control of memory to the programmer. • Java is a managed memory, language. • Still the JVM can't free up the memory, if the application is holding on to the objects. • Unnecessary accumulation of objects, o Object creation for each and every connection o Slow output rate in the input/output system o Collecting clusterwide messages without an upper bound.
  • 22. DeadLocks Resource A Resource B • Re-designing the lock acquiring sequence • Using LockManagers that keeps track of lock acquisition
  • 23. Liveness issues... • Starvation - A thread can starve for CPU cycles, if it is blocked by a lock-wait. • Poor Responsiveness • LiveLock scenarios
  • 24. Programming Best Practices • Think about memory aspects/ data retrieval process while writing code. • Optimize the critical Path (look at CPU profile). • Make use of Standard libs as much as possible. • Profile your apps before releasing them to production.
  • 25. WSO2 make use of profiling ?
  • 26. Identity Server - Losing weight • Carbon server optimized to run in constrained memory environment. • No front end components - 'createWorker' ant task. • Selective Admin service loading. -Doptimized=true • Removed unwanted functionality based on the use-case, (p2 - provisioning, etc)
  • 27. Raspberry-Pi Clusters • Application server cluster running on R- Pis. • Powering the WSO2Con 2013 mobile app • 512MB of RAM and ARM processor.
  • 28. Demo CPU spin and Memory leak scenario