SlideShare a Scribd company logo
Scalable Performance


Building enterprise-scale web applications that perform
Scalability vs. Performance



 • Ratio of the increase in          • Serving a single request in the
   throughput to an increase in        shortest amount of time
   resources                         • Inverse of latency
 • Support additional users at the
   least incremental cost
 • Predictability of application
   behavior as users are added
Scalable Performance



 • Number of requests that can be concurrently served
   (throughput) while meeting a minimum level of service
   (response time)
 • Measuring:
     o   Resource utilization
     o   Throughput
     o   Response time
Horizontal vs. Vertical Scaling



 • Increase the hardware resources       • Improve hardware capabilities
 • Separate types of processing into       (cpu, RAM, storage, etc…)
   tiers                                 • No network bottleneck
 • Commodity hardware is a               • Becomes increasingly expensive
   predictable cost per user             • Practical and financial limitations
 • Limitations to scaling are dictated     to the ability to scale
   by application architecture           • Typically increases performance
 • Can degrade performance
Horizontal vs. Vertical Scaling
General Observations



 • Performance decreases in each later tier (LB > web > app >
   DB) due to increasing complexity
     o   Service requests in the earliest possible tier
 • Costs of scalability increases in each later tier (LB < web <
   app < DB)
     o   Architect bottlenecks in the earliest possible tier
 • Scalable performance is ultimately limited by the operations
   that do not scale linearly
 • Ideally, each request that makes it to the database tier
   would have its own connection
     o   Realistically, this means serving requests in earlier tiers because of
         constraints to db scaling
JEE Request Processing
Application Bottlenecks



 •   Thread starvation
 •   Thread contention
 •   IO contention
 •   IO performance
 •   Memory limitations
 •   Data access
Resource Utilization
Resource Capacity Settings



 •   Database CPUs
 •   Database connection pool
 •   Application server CPUs
 •   Application server thread pool
 •   JVM Heap settings
 •   Web server thread pool
Resource Capacity Settings



 • Walk through the application architecture and identify the
   points where a request could potentially wait.
 • Open all wait points.
 • Generate balanced and representative load against the
   environment.
 • Identify the limiting wait point’s saturation point.
 • Tighten all wait points to facilitate only the maximum load of
   the limiting wait point.
 • Force all pending requests to wait at the Web server.
 • Add more resources.
Profiling



 •   Long running http requests
 •   Long running methods
 •   Memory leaks
 •   Deadlocks
 •   Long running queries
Database Tier



 • System of record
 • Difficult to scale horizontally and expensive to scale
   vertically
 • Keep connections limited to what the server will support
     o   Block at the app tier
 • Perform data processing on staging server
 • Each database has its own optimization techniques
     o   Explain plan to locate and eliminate full table scans
     o   Query and table caches
     o   Buffer sizes
Application Tier



 • Generally cannot be stateless due to security and business
   requirements
 • Sticky vs. clustered sessions
     o   Use the HTTPSession sparingly
     o   If the app does not need to be HA, it may not require clean failover
         and can drop sessions
 • Scaling horizontally could potentially put more load on the
   DB
     o   Caching can be used to offset the load
Application Caching



 • Read-only data can be cached like static data in the web
   tier
 • Write-able data can be cached but will impose limitations on
   clustering
     o   Will probably either need to be in-sync across the cluster or turned off
         completely
 • Filters can provide caching of dynamic, secure data at the
   earliest point in this tier
     o   Caches entire response
     o   Not recommended for user-specific data
 • Service layer or data access caches provide a simple way
   to stop requests from continuing to the database
     o   Transparent to the calling code
     o   Cache interceptors
Tomcat Tuning



 • maxThreads controls actively served connections
 • backlog controls the number of connections that can be
   queued
 • maxThreads + backlog = total accepted connections
 • connectionTimeout can be used to drop faulty connections
 • bufferSize is by default set to -1, no buffering of output
 • Keep heap size manageable, < 2GB
Web Tier



 • Clustering is easiest in the web tier because they are
   generally stateless
 • Web tier clustering can provide super-linear scaling (IO
   contention, context switching costs)
 • The web tier should serve all static data (images, static
   html)
 • The web tier can serve dynamic requests by caching non-
   secure data that only depends upon url parameters
     o   Squid reverse proxy
     o   Apache mod cache
     o   Memcached
Apache Tuning



 • Limit connections in the web tier to prevent overloading
   later tiers (MaxClients)
 • ServerLimit x Memory per process < RAM available to limit
   swapping
 • Avg connections = ThreadsPerChild x Apache hosts / App
   Server hosts
 • ProxyPass max = ThreadsPerChild
Other



 • Grid Caches
        o   GigaSpaces
        o   Coherence
 • CDN
        o   Akamai
 • Compute Appliances
        o   Azul Systems
References



 • http://www.theserverside.com/tt/articles/content/JIApresent
   ations/JIA-HASP.pdf
 • http://www.mnot.net/cache_docs/
 • http://httpd.apache.org/docs/2.2/misc/perf-tuning.html
 • http://www.yourkit.com/overview/index.jsp
 • http://dev2dev.bea.com/pub/a/2006/05/declarative-
   caching.html
 • http://azulsystems.com/
 • http://www.theserverside.com/tt/knowledgecenter/knowledg
   ecenter.tss?l=ProJavaEE_Ch06

More Related Content

PPTX
Content Devilery Network
PPT
Optimiszing proxy
PPT
Optimizing proxy
PPT
Weblogic - clustering failover, and load balancing
PPT
Optimiszing proxy
PPTX
Capacity Management/Provisioning (Cloud's full, Can't build here)
PPT
Dal deck
PDF
Enterprise WordPress - Performance, Scalability and Redundancy
Content Devilery Network
Optimiszing proxy
Optimizing proxy
Weblogic - clustering failover, and load balancing
Optimiszing proxy
Capacity Management/Provisioning (Cloud's full, Can't build here)
Dal deck
Enterprise WordPress - Performance, Scalability and Redundancy

What's hot (20)

PPTX
Cloud Design Pattern part2
PPTX
Hadoop introduction
PPT
The experiences of migrating a large scale, high performance healthcare network
PPT
Scalable Web Architectures and Infrastructure
PDF
Datasheet weblogic midvisionextensionforibmraf
PDF
HBaseCon2017 Apache HBase at Didi
PDF
Restful风格ž„web服务架构
PPTX
Server load balancer ppt
PDF
MariaDB High Availability Webinar
PPTX
Resource loading, prioritization, HTTP/2 - oh my!
PDF
Http2 in practice
PPTX
Change Data Capture using Kafka
PDF
Benchmarking Performance and Scalability with Web Stress
PPT
Weblogic-clustering-failover-and-load-balancing-training
KEY
Seda与Java并行编程点滴
PDF
SAP on Azure Web Dispatcher High Availability
PPTX
System design for video streaming service
PPTX
Peer Cache for Configuration Manager clients
PPT
Load Balancing
PPTX
Building WebLogic Domains With WLST
Cloud Design Pattern part2
Hadoop introduction
The experiences of migrating a large scale, high performance healthcare network
Scalable Web Architectures and Infrastructure
Datasheet weblogic midvisionextensionforibmraf
HBaseCon2017 Apache HBase at Didi
Restful风格ž„web服务架构
Server load balancer ppt
MariaDB High Availability Webinar
Resource loading, prioritization, HTTP/2 - oh my!
Http2 in practice
Change Data Capture using Kafka
Benchmarking Performance and Scalability with Web Stress
Weblogic-clustering-failover-and-load-balancing-training
Seda与Java并行编程点滴
SAP on Azure Web Dispatcher High Availability
System design for video streaming service
Peer Cache for Configuration Manager clients
Load Balancing
Building WebLogic Domains With WLST
Ad

Viewers also liked (18)

PPTX
Presentasi Message Confidentiality (Kerahasiaan Pesan)
PDF
4 sem pathology - 2005 to 2010 1
PPT
Ppa6 lecture ch_13
PPT
Electric charge and electric field
PPTX
Presentati Sisteam Antrian Real-Time
PPT
Chapter 3 motion in two d 2
PPT
чил презентация
PPTX
Presentasi Implementasi Algoritma ID3
PDF
IoT: from zero to hero for web developers - GDG DevFest Nantes 2016
PDF
Building IoT devices for fun and profit - Mobile Era 2016
PPT
Chapter 3 motion in two d
PPT
Chapter 15 thermodyanamic
PPT
Motion in one direction
PPTX
Implementasi Metode AHP (Kasus : Smartphone)
PPT
Electric charge and electric field
PDF
Run your JavaScript app for years on a coin cell - JSConf.asia 2016
PDF
Qué son los estilos de aprendizaje
Presentasi Message Confidentiality (Kerahasiaan Pesan)
4 sem pathology - 2005 to 2010 1
Ppa6 lecture ch_13
Electric charge and electric field
Presentati Sisteam Antrian Real-Time
Chapter 3 motion in two d 2
чил презентация
Presentasi Implementasi Algoritma ID3
IoT: from zero to hero for web developers - GDG DevFest Nantes 2016
Building IoT devices for fun and profit - Mobile Era 2016
Chapter 3 motion in two d
Chapter 15 thermodyanamic
Motion in one direction
Implementasi Metode AHP (Kasus : Smartphone)
Electric charge and electric field
Run your JavaScript app for years on a coin cell - JSConf.asia 2016
Qué son los estilos de aprendizaje
Ad

Similar to Performance and Scalability Tuning (20)

PPT
Large-scale projects development (scaling LAMP)
PDF
Scalability broad strokes
PPS
Web20expo Scalable Web Arch
PPS
Web20expo Scalable Web Arch
PPS
Web20expo Scalable Web Arch
PPT
Silicon India Java Conference: Building Scalable Solutions For Commerce Silic...
PPS
Scalable Web Architectures: Common Patterns and Approaches - Web 2.0 Expo NYC
PPTX
How to Build Scalable Websites in the Cloud
PDF
Scalability Design Principles - Internal Session
PDF
Scalability designprinciples-v2-130718023602-phpapp02 (1)
PPTX
Scalable Web Architecture and Distributed Systems
PPTX
Building Scalable Websites for the Cloud
PDF
Bottlenecks exposed web app db servers
PDF
Build A Scalable Mobile App
PPTX
Building-Scalable-Web-Applications.Presentation
PDF
Best Practices for Building Scalable Web Applications.pdf
PPTX
Application architecture for cloud
PPTX
05. performance-concepts
PPTX
Java Colombo: Developing Highly Scalable Apps
PDF
Scalable Architecture on Amazon AWS Cloud - Indicthreads cloud computing conf...
Large-scale projects development (scaling LAMP)
Scalability broad strokes
Web20expo Scalable Web Arch
Web20expo Scalable Web Arch
Web20expo Scalable Web Arch
Silicon India Java Conference: Building Scalable Solutions For Commerce Silic...
Scalable Web Architectures: Common Patterns and Approaches - Web 2.0 Expo NYC
How to Build Scalable Websites in the Cloud
Scalability Design Principles - Internal Session
Scalability designprinciples-v2-130718023602-phpapp02 (1)
Scalable Web Architecture and Distributed Systems
Building Scalable Websites for the Cloud
Bottlenecks exposed web app db servers
Build A Scalable Mobile App
Building-Scalable-Web-Applications.Presentation
Best Practices for Building Scalable Web Applications.pdf
Application architecture for cloud
05. performance-concepts
Java Colombo: Developing Highly Scalable Apps
Scalable Architecture on Amazon AWS Cloud - Indicthreads cloud computing conf...

Recently uploaded (20)

PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
cuic standard and advanced reporting.pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
Cloud computing and distributed systems.
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
cuic standard and advanced reporting.pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
Review of recent advances in non-invasive hemoglobin estimation
Understanding_Digital_Forensics_Presentation.pptx
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Agricultural_Statistics_at_a_Glance_2022_0.pdf
MIND Revenue Release Quarter 2 2025 Press Release
Reach Out and Touch Someone: Haptics and Empathic Computing
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Encapsulation_ Review paper, used for researhc scholars
Building Integrated photovoltaic BIPV_UPV.pdf
Unlocking AI with Model Context Protocol (MCP)
MYSQL Presentation for SQL database connectivity
Network Security Unit 5.pdf for BCA BBA.
Cloud computing and distributed systems.
Mobile App Security Testing_ A Comprehensive Guide.pdf
Diabetes mellitus diagnosis method based random forest with bat algorithm
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx

Performance and Scalability Tuning

  • 1. Scalable Performance Building enterprise-scale web applications that perform
  • 2. Scalability vs. Performance • Ratio of the increase in • Serving a single request in the throughput to an increase in shortest amount of time resources • Inverse of latency • Support additional users at the least incremental cost • Predictability of application behavior as users are added
  • 3. Scalable Performance • Number of requests that can be concurrently served (throughput) while meeting a minimum level of service (response time) • Measuring: o Resource utilization o Throughput o Response time
  • 4. Horizontal vs. Vertical Scaling • Increase the hardware resources • Improve hardware capabilities • Separate types of processing into (cpu, RAM, storage, etc…) tiers • No network bottleneck • Commodity hardware is a • Becomes increasingly expensive predictable cost per user • Practical and financial limitations • Limitations to scaling are dictated to the ability to scale by application architecture • Typically increases performance • Can degrade performance
  • 6. General Observations • Performance decreases in each later tier (LB > web > app > DB) due to increasing complexity o Service requests in the earliest possible tier • Costs of scalability increases in each later tier (LB < web < app < DB) o Architect bottlenecks in the earliest possible tier • Scalable performance is ultimately limited by the operations that do not scale linearly • Ideally, each request that makes it to the database tier would have its own connection o Realistically, this means serving requests in earlier tiers because of constraints to db scaling
  • 8. Application Bottlenecks • Thread starvation • Thread contention • IO contention • IO performance • Memory limitations • Data access
  • 10. Resource Capacity Settings • Database CPUs • Database connection pool • Application server CPUs • Application server thread pool • JVM Heap settings • Web server thread pool
  • 11. Resource Capacity Settings • Walk through the application architecture and identify the points where a request could potentially wait. • Open all wait points. • Generate balanced and representative load against the environment. • Identify the limiting wait point’s saturation point. • Tighten all wait points to facilitate only the maximum load of the limiting wait point. • Force all pending requests to wait at the Web server. • Add more resources.
  • 12. Profiling • Long running http requests • Long running methods • Memory leaks • Deadlocks • Long running queries
  • 13. Database Tier • System of record • Difficult to scale horizontally and expensive to scale vertically • Keep connections limited to what the server will support o Block at the app tier • Perform data processing on staging server • Each database has its own optimization techniques o Explain plan to locate and eliminate full table scans o Query and table caches o Buffer sizes
  • 14. Application Tier • Generally cannot be stateless due to security and business requirements • Sticky vs. clustered sessions o Use the HTTPSession sparingly o If the app does not need to be HA, it may not require clean failover and can drop sessions • Scaling horizontally could potentially put more load on the DB o Caching can be used to offset the load
  • 15. Application Caching • Read-only data can be cached like static data in the web tier • Write-able data can be cached but will impose limitations on clustering o Will probably either need to be in-sync across the cluster or turned off completely • Filters can provide caching of dynamic, secure data at the earliest point in this tier o Caches entire response o Not recommended for user-specific data • Service layer or data access caches provide a simple way to stop requests from continuing to the database o Transparent to the calling code o Cache interceptors
  • 16. Tomcat Tuning • maxThreads controls actively served connections • backlog controls the number of connections that can be queued • maxThreads + backlog = total accepted connections • connectionTimeout can be used to drop faulty connections • bufferSize is by default set to -1, no buffering of output • Keep heap size manageable, < 2GB
  • 17. Web Tier • Clustering is easiest in the web tier because they are generally stateless • Web tier clustering can provide super-linear scaling (IO contention, context switching costs) • The web tier should serve all static data (images, static html) • The web tier can serve dynamic requests by caching non- secure data that only depends upon url parameters o Squid reverse proxy o Apache mod cache o Memcached
  • 18. Apache Tuning • Limit connections in the web tier to prevent overloading later tiers (MaxClients) • ServerLimit x Memory per process < RAM available to limit swapping • Avg connections = ThreadsPerChild x Apache hosts / App Server hosts • ProxyPass max = ThreadsPerChild
  • 19. Other • Grid Caches o GigaSpaces o Coherence • CDN o Akamai • Compute Appliances o Azul Systems
  • 20. References • http://www.theserverside.com/tt/articles/content/JIApresent ations/JIA-HASP.pdf • http://www.mnot.net/cache_docs/ • http://httpd.apache.org/docs/2.2/misc/perf-tuning.html • http://www.yourkit.com/overview/index.jsp • http://dev2dev.bea.com/pub/a/2006/05/declarative- caching.html • http://azulsystems.com/ • http://www.theserverside.com/tt/knowledgecenter/knowledg ecenter.tss?l=ProJavaEE_Ch06