SlideShare ist ein Scribd-Unternehmen logo
1 von 20
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

Weitere ähnliche Inhalte

Was ist angesagt?

Scalable Web Architectures and Infrastructure
Scalable Web Architectures and InfrastructureScalable Web Architectures and Infrastructure
Scalable Web Architectures and Infrastructure
george.james
 
Datasheet weblogic midvisionextensionforibmraf
Datasheet weblogic midvisionextensionforibmrafDatasheet weblogic midvisionextensionforibmraf
Datasheet weblogic midvisionextensionforibmraf
MidVision
 
Benchmarking Performance and Scalability with Web Stress
Benchmarking Performance and Scalability with Web StressBenchmarking Performance and Scalability with Web Stress
Benchmarking Performance and Scalability with Web Stress
InterSystems Corporation
 
Load Balancing
Load BalancingLoad Balancing
Load Balancing
nashniv
 

Was ist angesagt? (20)

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

Andere mochten auch

Ppa6 lecture ch_13
Ppa6 lecture ch_13Ppa6 lecture ch_13
Ppa6 lecture ch_13
Chris Auld
 
Electric charge and electric field
Electric charge and electric fieldElectric charge and electric field
Electric charge and electric field
Chris Auld
 
Chapter 3 motion in two d 2
Chapter 3 motion in two d 2Chapter 3 motion in two d 2
Chapter 3 motion in two d 2
Chris Auld
 
чил презентация
чил презентациячил презентация
чил презентация
Doltz
 
Chapter 3 motion in two d
Chapter 3 motion in two dChapter 3 motion in two d
Chapter 3 motion in two d
Chris Auld
 
Chapter 15 thermodyanamic
Chapter 15 thermodyanamicChapter 15 thermodyanamic
Chapter 15 thermodyanamic
Chris Auld
 
Electric charge and electric field
Electric charge and electric fieldElectric charge and electric field
Electric charge and electric field
Chris Auld
 

Andere mochten auch (18)

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

Ähnlich wie Performance and Scalability Tuning

Building a highly scalable and available cloud application
Building a highly scalable and available cloud applicationBuilding a highly scalable and available cloud application
Building a highly scalable and available cloud application
Noam Sheffer
 
Building & Testing Scalable Rails Applications
Building & Testing Scalable Rails ApplicationsBuilding & Testing Scalable Rails Applications
Building & Testing Scalable Rails Applications
evilmike
 

Ähnlich wie Performance and Scalability Tuning (20)

4. (mjk) extreme performance 2
4. (mjk) extreme performance 24. (mjk) extreme performance 2
4. (mjk) extreme performance 2
 
Building a highly scalable and available cloud application
Building a highly scalable and available cloud applicationBuilding a highly scalable and available cloud application
Building a highly scalable and available cloud application
 
Cloud computing
Cloud computingCloud computing
Cloud computing
 
Cloud Computing - Geektalk
Cloud Computing - GeektalkCloud Computing - Geektalk
Cloud Computing - Geektalk
 
DevDay: Corda Enterprise: Journey to 1000 TPS per node, Rick Parker
DevDay: Corda Enterprise: Journey to 1000 TPS per node, Rick ParkerDevDay: Corda Enterprise: Journey to 1000 TPS per node, Rick Parker
DevDay: Corda Enterprise: Journey to 1000 TPS per node, Rick Parker
 
Pascal benois performance_troubleshooting-spsbe18
Pascal benois performance_troubleshooting-spsbe18Pascal benois performance_troubleshooting-spsbe18
Pascal benois performance_troubleshooting-spsbe18
 
Technical Architectures
Technical ArchitecturesTechnical Architectures
Technical Architectures
 
adap-stability-202310.pptx
adap-stability-202310.pptxadap-stability-202310.pptx
adap-stability-202310.pptx
 
Building data intensive applications
Building data intensive applicationsBuilding data intensive applications
Building data intensive applications
 
My Dissertation 2016
My Dissertation 2016My Dissertation 2016
My Dissertation 2016
 
Advanatages csc
Advanatages cscAdvanatages csc
Advanatages csc
 
Azure architecture design patterns - proven solutions to common challenges
Azure architecture design patterns - proven solutions to common challengesAzure architecture design patterns - proven solutions to common challenges
Azure architecture design patterns - proven solutions to common challenges
 
Expect the unexpected: Prepare for failures in microservices
Expect the unexpected: Prepare for failures in microservicesExpect the unexpected: Prepare for failures in microservices
Expect the unexpected: Prepare for failures in microservices
 
NoSQL – Data Center Centric Application Enablement
NoSQL – Data Center Centric Application EnablementNoSQL – Data Center Centric Application Enablement
NoSQL – Data Center Centric Application Enablement
 
From cache to in-memory data grid. Introduction to Hazelcast.
From cache to in-memory data grid. Introduction to Hazelcast.From cache to in-memory data grid. Introduction to Hazelcast.
From cache to in-memory data grid. Introduction to Hazelcast.
 
Scaling Systems: Architectures that grow
Scaling Systems: Architectures that growScaling Systems: Architectures that grow
Scaling Systems: Architectures that grow
 
Understanding System Design and Architecture Blueprints of Efficiency
Understanding System Design and Architecture Blueprints of EfficiencyUnderstanding System Design and Architecture Blueprints of Efficiency
Understanding System Design and Architecture Blueprints of Efficiency
 
Building & Testing Scalable Rails Applications
Building & Testing Scalable Rails ApplicationsBuilding & Testing Scalable Rails Applications
Building & Testing Scalable Rails Applications
 
Boost the Performance of SharePoint Today!
Boost the Performance of SharePoint Today!Boost the Performance of SharePoint Today!
Boost the Performance of SharePoint Today!
 
Caching up is hard to do: Improving your Web Services' Performance
Caching up is hard to do: Improving your Web Services' PerformanceCaching up is hard to do: Improving your Web Services' Performance
Caching up is hard to do: Improving your Web Services' Performance
 

Kürzlich hochgeladen

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Kürzlich hochgeladen (20)

Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 

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