LOAD & PERFORMANCE TESTING FOR J2EE · PDF fileLOAD & PERFORMANCE TESTING FOR J2EE ... Load & Performance Testing for J2EE 3 PERFORMANCE BASICS 1.1. ... Process for Maven

Embed Size (px)

Citation preview

  • LOAD & PERFORMANCE TESTING FOR J2EE

    Alexandru Ersenie

    Senior Load & Performance Test Engineer

    Edict eGaming GmbH, Hamburg

    [email protected]

    http://www.alexandru-ersenie.com

    TESTING, MONITORING, ANALYSING AND REPORTING USING OPEN SOURCE TOOLS

    mailto:[email protected]

  • 07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 2

    AGENDA

    SAMPLING/PROFILING

    3 TIER TUNING

    VIRTUALIZATION

    TESTING IN THE CLOUD

    SECURITY

    LOGGING

    BEST PRACTICES

    NETWORKING........

    PERFORMANCE BASICS

    Scope

    Metrics

    Factors on Performance

    Performance Reports

    Generating Load

    IMONITORING

    Monitoring types

    CPU Monitoring

    Other Performance Monitors

    Reactive Monitoring/Reporting

    II

    JVM GC and Heap Monitoring

    TOOLS

    Monitoring

    Reporting

    Analysis

    III

  • 07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 3

    PERFORMANCE BASICS

    1.1

  • 07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 4

    1.1 DEFINITION AND SCOPE

    PERFORMANCE

    Short response time for a given piece of work

    High throughput (rate of processing work)

    Low utilization of computing resources

    High availability of the computing system or application

    Efficient usage of hardware resources;

    Storage

    Continue to operatedespite errors

    SCALABILITY

    Handle growing amountof work;

    Ability to enlargeto accommodate more

    work

    EFFICIENCY RELIABILITY

    Recover after failure;

    Mean time between failures

    ROBUSTNESS

    Non functionalrequirements

  • 07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 5

    1.1 REAL WORLD NUMBERS

    1 second of slower performance on pages could cost Amazon $1.6 billion in sales each year

    25% of users will leave a site if a page takes more than 4 seconds to load.

    http://performance-testing.org/performance-testing-statisticshttp://en.wikipedia.org/wiki/BigTable

    RESPONSE TIMES

    Facebook serves more than 2 million Like buttons per second (June 2010).

    Facebook held a clear lead in total page views during March 2011, recording about 85 billion. This was more than three times as many as number two Google, which had about 25.6 billion

    THROUGHPUT

    Google uses a compressed, high performance, proprietary data storage file system, (...) designed to scale into the petabyte range (1000 terabytes)

    EFFICIENCY

  • 07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 6

    METRICS

    1.2

  • 07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 7

    1.2 METRICS

    OPTIMISTIC

    SLA are already definedConcurrent usersTransactions / SecondResponse TimesStorage

    Concurrent users10 000 logged in users50 000 visitors

    Transactions / Second1 000 business transactions / second4 000 web requests / second

    Response TimesLanding page total load time less than 8 seconds for 70 % of the usersTransaction Response time less than 2 seconds for 90 % of all transactions

    StorageMaximum 100 bytes per transaction

    TEST TO ACCHIEVE DEFINED SOFTWARE LEVEL AGREEMENTS

    How many transactions can the system handle

    How many sessions can the system handle

    What is the average response size

    What is the 90 % value / business case

    How much space will a transaction use in the database

    REAL WORLD PROJECTS

    SLA are not definedConcurrent usersTransactions / SecondResponse TimesStorage

    ?TEST TO DEFINE

    SOFTWARE LEVEL AGREEMENTS

    ?

  • 07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 8

    RESPONSE TIMES

    What are the response times that users are receiving when performing specific transactions in the system:

    Minimum / Maximum / Average response time50 to 90 percent line

    1.2 METRICS

    THROUGHPUT

    How many users can the system handle, and how many transactions can the system handle in a unit of time

    Transactions per second

    As the number of users using the system increases,the throughput increases as well. The system is busysatisfying user requests

    When the systems limit is reached, the throughput decreases, and waiting occurs, since the system is busy managing itself in order to satisfy all user requests

  • 07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 9

    FACTORS ON PERFORMANCE

    1.3

  • 07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 10

    SOFTWARESoftware design, architecture and configuration have great impact on performance:

    PROGRAMMING CONFIGURATION

    JVMConfig

    ThreadPool

    EJBcontainer

    JDBCMax-connections=5;jdbc-connection-timeout=5

    Sync.errors

    Deadlocks

    Race conditions

    Arithmeticerrors

    Buffer overflow

    Arithm. exceptions

    Redundantoperations

    Dead code

    Redundant assign

    Other

    -Xmx:2G-XX:NewSize:1.8G-XX:NewSize:1.8G

    max-threadpoolsize=5

    Max-cachesize=512; cache-timeout=3600

    Memoryleaks

    80 % of all performanceproblems in JAVA

    1.3 FACTORS ON PERFORMANCE

  • 07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 11

    HARDWARE

    WINDOWS5000cons

    LINUX1024Openfiles

    Database Server and Hardware

    Hardware /Configuration

    OS / File System

    1 Server

    APPServer

    WebServer

    DBServer

    Single 3 Tier Server

    DB Server /Hardware

    Oracle Standard

    CPU

    CPU

    Oracle Enterprise

    CPU

    CPU

    CPU

    CPU

    CPU

    CPU

    No partitioningLimited online operationsLimited indexing

    MSSql MySQL

    Different lockingimplementation

    DifferentIndex performance

    default range for dynamic ports in Windows is 1024 to 5000Unix systems have a default maximum open files limit of 1024

    1.3 FACTORS ON PERFORMANCE

    Shared resources:CPUMemoryNetworkDiskVirtualization

  • 07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 12

    GENERATING LOAD

    1.4

  • 07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 13

    Web &

    ApplicationServer

    LOADAGENT

    LOADAGENT

    LOADAGENT

    LOADAGENT

    LOAD DISPATCHER

    1.4 GENERATING LOAD

    WHAT DO WE NEED?

    Test ResultsDB

    ReportingServer

    Reports

    MONITORS

  • 07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 14

    1.4 GENERATING LOAD

    IMPLEMENTATIONMODEL

    Web &

    ApplicationServer

    JMETER

    JMETER

    JMETER

    JMETER

    JMETERCONTROLLER

    MY SQLDB

    JASPERSERVER

    JASPERREPORTS

    JMX;REST

    MONITORS

  • 07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 15

    LOAD AGENTS

    Virtual UsersRamp up time

    Pause times

    Number of transactions

    Number of repetitions

    Increasing rate/repetition

    Server and Port

    MONITORSObject usage

    EJB ResourcesJDBC Resources

    CPU Time

    HEAP Monitoring

    REPORTINGProcess for DB Import

    Process for Maven

    Process for other formats

    Generate Load

    Collect Response Times

    Monitor Hardware Resources

    Monitor System Resources

    Process Results

    Import results into database

    Generate Reports

    DISPATCHER

    1.4 GENERATING LOAD

    'users=200 ramptime=200 pausetime=2000 pausetimedev=500 transactions=100 repeats=1 loopsinrepeat=1 warmup=no' 'hostname=myserver port=8080 protocol=https'

    'trace_objects=yes monitor_server=yes'

    'generatereport=yes '

    /start_test.sh

  • 07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 16

    FUNCTIONS

    configure_serverempty_logsmonitor_resourcesgenerate_report

    start_testserver_warmupJMETER DISPATCHER

    FOLDER

    /includes

    /scripts

    SCRIPT REPO

    PLACE ORDER

    EXPORT

    LOGINHOMEPAGE

    REGISTRATION

    Scripts call functions to control the test workflow

    /testplans

    TESTPLAN REPO

    T_Place_Order

    T_Export

    T_LoginT_Homepage

    T_Registration

    Scripts start test plans by using functions

    /results RESULTS

    Results are stored here

    MY SQLDB

    Processed results are exported to a database

    JASPERREPORTS

    Reports are generated from the DB

    1.4 GENERATING LOAD

    IMPLEMENTATIONMODEL

  • 07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 17

    PERFORMANCEREPORT

    1.5

  • 07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 18

    1.5 Performance Report

    SUMMARY METRICS / TRANSACTION JVM CONFIGURATION

    CPU USAGE HEAP USAGETHROUGHPUT & RESPONSE TIMES

  • 07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 19

    MONITORING

    2

  • 07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 20

    Allows real time monitoring of critical resources

    Active Monitoring CPU UsageCPU Usage Heap UsageHeap Usage

    Thread UsageThread UsageAllows real time interfering with the system:

    Execute Garbage CollectionGenerate Thread DumpAnalyze thread activityGenerate Heap Dump

    Enables monitoring the system's limits

    Allows a better understanding of how the system behaves depending on the load scenario, and theuser behavior, thus enabling to determine what the system can perform

    Allows quickly modifying either the test configuration,or the software/hardware