SlideShare uma empresa Scribd logo
1 de 10
Baixar para ler offline
High-Performance Java



          Bill La Forge
  CTO, Jactor Consulting
 http://jactorconsulting.com
High-Performance Java
●   When is it needed?
●   Development Methodology
●   High-Performance Considerations
When is it Needed?
●   Most Java code is fast enough for its intended
    use.
●   When optimization is needed, it is usually best
    done after the code is debugged.
●   But when the utility of the code is directly linked
    to its performance, the development of high-
    performance code can sometimes justify the
    expense of its development.
Development Methodology
●   A test-centric approach is needed to identify
    non-performant code early in the development
    cycle.
●   Performance testing is needed in both unit
    testing and system testing.
●   For critical sections of code it is sometimes
    better to duplicate code instead of subclassing.
    But a small memory footprint may be more
    important. Finding the most performant
    compromises requires performance testing.
High-Performance
                  Considerations
●   Algorithms
●   JIT
●   Garbage Collection
●   Multi-Threading
●   Memory Architecture
Algorithms
●   There is no best algorithm or best data
    structure, only best fit for a specific context.
●   Algorithms which fit in high-speed cache may
    perform better than expected.
●   Array backed data structures shared across
    threads may work better than linked data
    structures.
●   Critical performance considerations are often
    opaque, with performance testing the only
    recourse.
JIT
●   Methods with bytecode longer than 60 bytes
    are NOT optimized, so adding a line of code to
    a method will sometimes result in a dramatic
    loss of speed.
●   Use final classes and final methods where
    possible. Consider code duplication in place of
    subclassing for critical sections.
●   Performance tests should exercise code heavily
    before doing any timings to ensure that the JIT
    has compiled the bytecode under test.
Garbage Collection
●   Garbage collection is a common cause for non-
    performant code.
●   Minimize object creation within loops.
●   Minimize the number of references an object
    has to other objects.
●   Avoid circular structures as much as possible.
●   Clear references to objects as soon as
    possible.
Multi-Threading
●   In general, using a single thread is orders of
    magnitude faster than using multiple threads,
    as passing data between threads is
    comparitively slow.
●   When there is justification for passing data
    between threads, pass as much a possible
    each time. For example, use a pipeline where
    backpressure from the next stage is used to
    control the amount of data being passed.
●   When passing data between threads, flow
    control is critical for good overall performance.
Memory Architecture
●   When using a thread pool, remember that the code
    and the data will need to be loaded into the CPU's
    local cache, making for a slow start when a thread is
    allocated a task. And having more CPUs only makes
    this worse.
●   Linked data structures make for frequent cache
    misses, which is why table-backed sturctures are often
    faster.
●   Sharing data blocks between threads, especially when
    more than one thread does the updates, will slow
    things down—even if the same data within a block is
    not being shared.

Mais conteúdo relacionado

Destaque

Microservices for performance - GOTO Chicago 2016
Microservices for performance - GOTO Chicago 2016Microservices for performance - GOTO Chicago 2016
Microservices for performance - GOTO Chicago 2016Peter Lawrey
 
Java Performance, Threading and Concurrent Data Structures
Java Performance, Threading and Concurrent Data StructuresJava Performance, Threading and Concurrent Data Structures
Java Performance, Threading and Concurrent Data StructuresHitendra Kumar
 
High performance java ee with j cache and cdi
High performance java ee with j cache and cdiHigh performance java ee with j cache and cdi
High performance java ee with j cache and cdiPayara
 
SSO with the WSO2 Identity Server
SSO with the WSO2 Identity ServerSSO with the WSO2 Identity Server
SSO with the WSO2 Identity ServerWSO2
 
Practical Steps For Building High Performance Teams
Practical Steps For Building High Performance TeamsPractical Steps For Building High Performance Teams
Practical Steps For Building High Performance TeamsElijah Ezendu
 
High-performance Team Development
High-performance Team DevelopmentHigh-performance Team Development
High-performance Team DevelopmentPeter Pfeiffer
 
Leading High Performance Teams
Leading High Performance TeamsLeading High Performance Teams
Leading High Performance TeamsUbersoldat
 
WSO2 Identity Server 5.3.0 - Product Release Webinar
WSO2 Identity Server 5.3.0 - Product Release WebinarWSO2 Identity Server 5.3.0 - Product Release Webinar
WSO2 Identity Server 5.3.0 - Product Release WebinarWSO2
 
High Performance Java EE with JCache and CDI
High Performance Java EE with JCache and CDIHigh Performance Java EE with JCache and CDI
High Performance Java EE with JCache and CDIPayara
 
High Performance Flow Matching Architecture for Openflow Data Plane
High Performance Flow Matching Architecture for Openflow Data PlaneHigh Performance Flow Matching Architecture for Openflow Data Plane
High Performance Flow Matching Architecture for Openflow Data PlaneMahesh Dananjaya
 
SAML Protocol Overview
SAML Protocol OverviewSAML Protocol Overview
SAML Protocol OverviewMike Schwartz
 
Java Performance Analysis on Linux with Flame Graphs
Java Performance Analysis on Linux with Flame GraphsJava Performance Analysis on Linux with Flame Graphs
Java Performance Analysis on Linux with Flame GraphsBrendan Gregg
 
SAML / OpenID Connect / OAuth / SCIM 技術解説 - ID&IT 2014 #idit2014
SAML / OpenID Connect / OAuth / SCIM 技術解説  - ID&IT 2014 #idit2014SAML / OpenID Connect / OAuth / SCIM 技術解説  - ID&IT 2014 #idit2014
SAML / OpenID Connect / OAuth / SCIM 技術解説 - ID&IT 2014 #idit2014Nov Matake
 
15 Years of Web Security: The Rebellious Teenage Years
15 Years of Web Security: The Rebellious Teenage Years15 Years of Web Security: The Rebellious Teenage Years
15 Years of Web Security: The Rebellious Teenage YearsJeremiah Grossman
 
Java Performance: Speedup your application with hardware counters
Java Performance: Speedup your application with hardware countersJava Performance: Speedup your application with hardware counters
Java Performance: Speedup your application with hardware countersSergey Kuksenko
 

Destaque (19)

WSO2 Identity Server
WSO2 Identity ServerWSO2 Identity Server
WSO2 Identity Server
 
Microservices for performance - GOTO Chicago 2016
Microservices for performance - GOTO Chicago 2016Microservices for performance - GOTO Chicago 2016
Microservices for performance - GOTO Chicago 2016
 
Java Performance, Threading and Concurrent Data Structures
Java Performance, Threading and Concurrent Data StructuresJava Performance, Threading and Concurrent Data Structures
Java Performance, Threading and Concurrent Data Structures
 
High performance java ee with j cache and cdi
High performance java ee with j cache and cdiHigh performance java ee with j cache and cdi
High performance java ee with j cache and cdi
 
SSO with the WSO2 Identity Server
SSO with the WSO2 Identity ServerSSO with the WSO2 Identity Server
SSO with the WSO2 Identity Server
 
Practical Steps For Building High Performance Teams
Practical Steps For Building High Performance TeamsPractical Steps For Building High Performance Teams
Practical Steps For Building High Performance Teams
 
High-performance Team Development
High-performance Team DevelopmentHigh-performance Team Development
High-performance Team Development
 
Leading High Performance Teams
Leading High Performance TeamsLeading High Performance Teams
Leading High Performance Teams
 
WSO2 Identity Server 5.3.0 - Product Release Webinar
WSO2 Identity Server 5.3.0 - Product Release WebinarWSO2 Identity Server 5.3.0 - Product Release Webinar
WSO2 Identity Server 5.3.0 - Product Release Webinar
 
High Performance Java EE with JCache and CDI
High Performance Java EE with JCache and CDIHigh Performance Java EE with JCache and CDI
High Performance Java EE with JCache and CDI
 
SAML Smackdown
SAML SmackdownSAML Smackdown
SAML Smackdown
 
High Performance Flow Matching Architecture for Openflow Data Plane
High Performance Flow Matching Architecture for Openflow Data PlaneHigh Performance Flow Matching Architecture for Openflow Data Plane
High Performance Flow Matching Architecture for Openflow Data Plane
 
SAML Protocol Overview
SAML Protocol OverviewSAML Protocol Overview
SAML Protocol Overview
 
Java Performance Analysis on Linux with Flame Graphs
Java Performance Analysis on Linux with Flame GraphsJava Performance Analysis on Linux with Flame Graphs
Java Performance Analysis on Linux with Flame Graphs
 
Introduction to SAML
Introduction to SAMLIntroduction to SAML
Introduction to SAML
 
SAML / OpenID Connect / OAuth / SCIM 技術解説 - ID&IT 2014 #idit2014
SAML / OpenID Connect / OAuth / SCIM 技術解説  - ID&IT 2014 #idit2014SAML / OpenID Connect / OAuth / SCIM 技術解説  - ID&IT 2014 #idit2014
SAML / OpenID Connect / OAuth / SCIM 技術解説 - ID&IT 2014 #idit2014
 
15 Years of Web Security: The Rebellious Teenage Years
15 Years of Web Security: The Rebellious Teenage Years15 Years of Web Security: The Rebellious Teenage Years
15 Years of Web Security: The Rebellious Teenage Years
 
IdP, SAML, OAuth
IdP, SAML, OAuthIdP, SAML, OAuth
IdP, SAML, OAuth
 
Java Performance: Speedup your application with hardware counters
Java Performance: Speedup your application with hardware countersJava Performance: Speedup your application with hardware counters
Java Performance: Speedup your application with hardware counters
 

Mais de Bill La Forge

JActor Cluster Platform
JActor Cluster PlatformJActor Cluster Platform
JActor Cluster PlatformBill La Forge
 
Incremental Java Deserialization/Reserialization
Incremental Java Deserialization/ReserializationIncremental Java Deserialization/Reserialization
Incremental Java Deserialization/ReserializationBill La Forge
 

Mais de Bill La Forge (6)

JA Brocure v3
JA Brocure v3JA Brocure v3
JA Brocure v3
 
Jactor for Dummies
Jactor for DummiesJactor for Dummies
Jactor for Dummies
 
JActor Cluster Platform
JActor Cluster PlatformJActor Cluster Platform
JActor Cluster Platform
 
Incremental Java Deserialization/Reserialization
Incremental Java Deserialization/ReserializationIncremental Java Deserialization/Reserialization
Incremental Java Deserialization/Reserialization
 
Code Samples
Code SamplesCode Samples
Code Samples
 
Actors in the Small
Actors in the SmallActors in the Small
Actors in the Small
 

Último

IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfIaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfDaniel Santiago Silva Capera
 
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
 
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024D Cloud Solutions
 
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
 
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfUiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfDianaGray10
 
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
 
Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxGDSC PJATK
 
Cloud Revolution: Exploring the New Wave of Serverless Spatial Data
Cloud Revolution: Exploring the New Wave of Serverless Spatial DataCloud Revolution: Exploring the New Wave of Serverless Spatial Data
Cloud Revolution: Exploring the New Wave of Serverless Spatial DataSafe Software
 
GenAI and AI GCC State of AI_Object Automation Inc
GenAI and AI GCC State of AI_Object Automation IncGenAI and AI GCC State of AI_Object Automation Inc
GenAI and AI GCC State of AI_Object Automation IncObject Automation
 
Comparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioComparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioChristian Posta
 
UiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPathCommunity
 
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
 
Bird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemBird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemAsko Soukka
 
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostKubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostMatt Ray
 
PicPay - GenAI Finance Assistant - ChatGPT for Customer Service
PicPay - GenAI Finance Assistant - ChatGPT for Customer ServicePicPay - GenAI Finance Assistant - ChatGPT for Customer Service
PicPay - GenAI Finance Assistant - ChatGPT for Customer ServiceRenan Moreira de Oliveira
 
UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8DianaGray10
 
Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Commit University
 
Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintEmpowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintMahmoud Rabie
 
Machine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfMachine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfAijun Zhang
 
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
 

Último (20)

IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfIaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
 
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
 
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024
 
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
 
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfUiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
 
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...
 
Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptx
 
Cloud Revolution: Exploring the New Wave of Serverless Spatial Data
Cloud Revolution: Exploring the New Wave of Serverless Spatial DataCloud Revolution: Exploring the New Wave of Serverless Spatial Data
Cloud Revolution: Exploring the New Wave of Serverless Spatial Data
 
GenAI and AI GCC State of AI_Object Automation Inc
GenAI and AI GCC State of AI_Object Automation IncGenAI and AI GCC State of AI_Object Automation Inc
GenAI and AI GCC State of AI_Object Automation Inc
 
Comparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioComparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and Istio
 
UiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation Developers
 
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
 
Bird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemBird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystem
 
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostKubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
 
PicPay - GenAI Finance Assistant - ChatGPT for Customer Service
PicPay - GenAI Finance Assistant - ChatGPT for Customer ServicePicPay - GenAI Finance Assistant - ChatGPT for Customer Service
PicPay - GenAI Finance Assistant - ChatGPT for Customer Service
 
UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8
 
Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)
 
Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintEmpowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership Blueprint
 
Machine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfMachine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdf
 
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
 

High performance-java

  • 1. High-Performance Java Bill La Forge CTO, Jactor Consulting http://jactorconsulting.com
  • 2. High-Performance Java ● When is it needed? ● Development Methodology ● High-Performance Considerations
  • 3. When is it Needed? ● Most Java code is fast enough for its intended use. ● When optimization is needed, it is usually best done after the code is debugged. ● But when the utility of the code is directly linked to its performance, the development of high- performance code can sometimes justify the expense of its development.
  • 4. Development Methodology ● A test-centric approach is needed to identify non-performant code early in the development cycle. ● Performance testing is needed in both unit testing and system testing. ● For critical sections of code it is sometimes better to duplicate code instead of subclassing. But a small memory footprint may be more important. Finding the most performant compromises requires performance testing.
  • 5. High-Performance Considerations ● Algorithms ● JIT ● Garbage Collection ● Multi-Threading ● Memory Architecture
  • 6. Algorithms ● There is no best algorithm or best data structure, only best fit for a specific context. ● Algorithms which fit in high-speed cache may perform better than expected. ● Array backed data structures shared across threads may work better than linked data structures. ● Critical performance considerations are often opaque, with performance testing the only recourse.
  • 7. JIT ● Methods with bytecode longer than 60 bytes are NOT optimized, so adding a line of code to a method will sometimes result in a dramatic loss of speed. ● Use final classes and final methods where possible. Consider code duplication in place of subclassing for critical sections. ● Performance tests should exercise code heavily before doing any timings to ensure that the JIT has compiled the bytecode under test.
  • 8. Garbage Collection ● Garbage collection is a common cause for non- performant code. ● Minimize object creation within loops. ● Minimize the number of references an object has to other objects. ● Avoid circular structures as much as possible. ● Clear references to objects as soon as possible.
  • 9. Multi-Threading ● In general, using a single thread is orders of magnitude faster than using multiple threads, as passing data between threads is comparitively slow. ● When there is justification for passing data between threads, pass as much a possible each time. For example, use a pipeline where backpressure from the next stage is used to control the amount of data being passed. ● When passing data between threads, flow control is critical for good overall performance.
  • 10. Memory Architecture ● When using a thread pool, remember that the code and the data will need to be loaded into the CPU's local cache, making for a slow start when a thread is allocated a task. And having more CPUs only makes this worse. ● Linked data structures make for frequent cache misses, which is why table-backed sturctures are often faster. ● Sharing data blocks between threads, especially when more than one thread does the updates, will slow things down—even if the same data within a block is not being shared.