lab-4410: benchmarking and profiling web 2.0 applications ...€¦ · 2007 javaonesm conference |...

37
2007 JavaOne SM Conference | LAB-4410 | LAB-4410 LAB-4410: Benchmarking and Profiling Web 2.0 Applications for Performance Deep Singh, Kim LiChong, Suveen Nadipalli, Rahul Biswas and Venkana Goudar Staff members, Enterprise Java Performance Group Sun Microsystems, Inc http://www.sun.com

Upload: others

Post on 26-Jul-2020

8 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: LAB-4410: Benchmarking and Profiling Web 2.0 Applications ...€¦ · 2007 JavaOneSM Conference | LAB-4410 | 3 How Instructor-Led Hands-on Lab Works Instructors will guide you through

2007 JavaOneSM Conference | LAB-4410 |

LAB-4410

LAB-4410: Benchmarking and Profiling Web 2.0 Applications for Performance

Deep Singh, Kim LiChong, Suveen Nadipalli, Rahul Biswas and Venkana Goudar

Staff members, Enterprise Java Performance GroupSun Microsystems, Inchttp://www.sun.com

Page 2: LAB-4410: Benchmarking and Profiling Web 2.0 Applications ...€¦ · 2007 JavaOneSM Conference | LAB-4410 | 3 How Instructor-Led Hands-on Lab Works Instructors will guide you through

2007 JavaOneSM Conference | LAB-4410 | 2

Goal of This Lab

Learn how to benchmark, profile and tunea Web 2.0 application

Page 3: LAB-4410: Benchmarking and Profiling Web 2.0 Applications ...€¦ · 2007 JavaOneSM Conference | LAB-4410 | 3 How Instructor-Led Hands-on Lab Works Instructors will guide you through

2007 JavaOneSM Conference | LAB-4410 | 3

How Instructor-Led Hands-on Lab Works

● Instructors will guide you through whenever appropriate

● You will do the lab by reading the lab document that is displayed on your screen after log-in

● The hard-copy of the lab document is also provided

● Feel free to get help from on-site proctors

Page 4: LAB-4410: Benchmarking and Profiling Web 2.0 Applications ...€¦ · 2007 JavaOneSM Conference | LAB-4410 | 3 How Instructor-Led Hands-on Lab Works Instructors will guide you through

2007 JavaOneSM Conference | LAB-4410 | 4

Quick Walk-through

● If you have not logged in, log in with● username: 4410 (Lab number)● password: javaone07

● Online lab document gets displayed● All necessary software and lab files are already

installed on your lab machine

Page 5: LAB-4410: Benchmarking and Profiling Web 2.0 Applications ...€¦ · 2007 JavaOneSM Conference | LAB-4410 | 3 How Instructor-Led Hands-on Lab Works Instructors will guide you through

2007 JavaOneSM Conference | LAB-4410 | 5

Lab Format

● “Free form” lab● This lab is for 120 mins● 6 exercises

● 3 will be instructor-led, 3 will be self-paced.● 3 additional exercises at the end

● No hand holding here, just hints

Page 6: LAB-4410: Benchmarking and Profiling Web 2.0 Applications ...€¦ · 2007 JavaOneSM Conference | LAB-4410 | 3 How Instructor-Led Hands-on Lab Works Instructors will guide you through

2007 JavaOneSM Conference | LAB-4410 | 6

Agenda With Section Highlights

● Examining jMaki StockPortfolio application● How to write your Benchmark Driver● Learn Server Side Tunings● Optional exercises:

● Profiling your application● Debugging your application● Faban Framework overview

Page 7: LAB-4410: Benchmarking and Profiling Web 2.0 Applications ...€¦ · 2007 JavaOneSM Conference | LAB-4410 | 3 How Instructor-Led Hands-on Lab Works Instructors will guide you through

2007 JavaOneSM Conference | LAB-4410 | 7

Agenda With Section Highlights

● Examining jMaki StockPortfolio application● How to write your Benchmark Driver● Learn Server Side Tunings● Optional exercises:

● Profiling● Debugging● Faban Framework

Page 8: LAB-4410: Benchmarking and Profiling Web 2.0 Applications ...€¦ · 2007 JavaOneSM Conference | LAB-4410 | 3 How Instructor-Led Hands-on Lab Works Instructors will guide you through

2007 JavaOneSM Conference | LAB-4410 | 8

jMaki Stock Application

● Very simple Web 2.0 application● dojo table containing single stock symbol

● stock price is updated through logic contained in Servlet and Bean class

● 2 operations:● on first loading of page● on subsequent updates

Page 9: LAB-4410: Benchmarking and Profiling Web 2.0 Applications ...€¦ · 2007 JavaOneSM Conference | LAB-4410 | 3 How Instructor-Led Hands-on Lab Works Instructors will guide you through

2007 JavaOneSM Conference | LAB-4410 | 9

jMaki Stock Application

● Open Netbeans IDE● Let's look at some code● index.jsp

● jmaki widget● Javascript function

● UpdateServlet.java

Page 10: LAB-4410: Benchmarking and Profiling Web 2.0 Applications ...€¦ · 2007 JavaOneSM Conference | LAB-4410 | 3 How Instructor-Led Hands-on Lab Works Instructors will guide you through

2007 JavaOneSM Conference | LAB-4410 | 10

jMaki Stock Application

● Is your Glassfish application server running?(see Exercise 0, #7)

● Build, Run and Deploy application● Test deployment at

http://localhost:8080/stockportfolioapp_jmaki

Page 11: LAB-4410: Benchmarking and Profiling Web 2.0 Applications ...€¦ · 2007 JavaOneSM Conference | LAB-4410 | 3 How Instructor-Led Hands-on Lab Works Instructors will guide you through

2007 JavaOneSM Conference | LAB-4410 | 11

DEMOBuild, Deploy and Test StockPortfolio Application

Page 12: LAB-4410: Benchmarking and Profiling Web 2.0 Applications ...€¦ · 2007 JavaOneSM Conference | LAB-4410 | 3 How Instructor-Led Hands-on Lab Works Instructors will guide you through

2007 JavaOneSM Conference | LAB-4410 | 12

Agenda With Section Highlights

● Examining jMaki StockPortfolio application● How to write your Benchmark Driver● Learn Server Side Tunings● Optional exercises:

● Profiling● Debugging● Faban Framework

Page 13: LAB-4410: Benchmarking and Profiling Web 2.0 Applications ...€¦ · 2007 JavaOneSM Conference | LAB-4410 | 3 How Instructor-Led Hands-on Lab Works Instructors will guide you through

2007 JavaOneSM Conference | LAB-4410 | 13

Write Web 2.0 benchmark driver● Introduction to Faban driver framework● Capturing HTTP headers● Write Faban driver class● Configure your performance test ● Run performance test● Analyze performance test results

Page 14: LAB-4410: Benchmarking and Profiling Web 2.0 Applications ...€¦ · 2007 JavaOneSM Conference | LAB-4410 | 3 How Instructor-Led Hands-on Lab Works Instructors will guide you through

2007 JavaOneSM Conference | LAB-4410 | 14

Introduction to Faban driver framework● Faban is free and open source performance

benchmark framework● http://faban.sunsource.net

● Faban benchmark framework consists of a driver framework and a harness● Driver will be discussed briefly in Ex 2● Harness will be covered in Ex 6

● Faban driver framework contains necessary infrastructure to run performance tests● Needs user written driver class and configuration file● The driver class simulates user interactions using

supplied HTTP URLs

Page 15: LAB-4410: Benchmarking and Profiling Web 2.0 Applications ...€¦ · 2007 JavaOneSM Conference | LAB-4410 | 3 How Instructor-Led Hands-on Lab Works Instructors will guide you through

2007 JavaOneSM Conference | LAB-4410 | 15

Capturing HTTP headers● Faban driver class needs HTTP URLs to load

dependencies for each web interaction● Dependencies can be located from HTTP

headers for each web interaction● HTTP headers can be captured using Mozilla's

LiveHTTPHeaders plugin● Captured headers should be saved in a file known

to Faban driver class.● During runtime, Faban driver class will read HTTP

headers file and fetch each listed URL from the server

Page 16: LAB-4410: Benchmarking and Profiling Web 2.0 Applications ...€¦ · 2007 JavaOneSM Conference | LAB-4410 | 3 How Instructor-Led Hands-on Lab Works Instructors will guide you through

2007 JavaOneSM Conference | LAB-4410 | 16

DEMOCapture HTTP headers

Page 17: LAB-4410: Benchmarking and Profiling Web 2.0 Applications ...€¦ · 2007 JavaOneSM Conference | LAB-4410 | 3 How Instructor-Led Hands-on Lab Works Instructors will guide you through

2007 JavaOneSM Conference | LAB-4410 | 17

Write Faban driver class● Faban driver class is a simple Java Object● The driver class is run in multi-threaded mode on

a single JVM● It is possible to run multiple drivers on same or different

machines using master and agent setup. (out of scope for this lab)

● The driver class uses Java annotations to define runtime characteristics for the driver threads

● The driver class has user defined methods which connect to the application deployed on server

Page 18: LAB-4410: Benchmarking and Profiling Web 2.0 Applications ...€¦ · 2007 JavaOneSM Conference | LAB-4410 | 3 How Instructor-Led Hands-on Lab Works Instructors will guide you through

2007 JavaOneSM Conference | LAB-4410 | 18

Write Faban driver class

● Open Netbeans IDE● Follow lab document index.html● Inspect WebDriver.java

Page 19: LAB-4410: Benchmarking and Profiling Web 2.0 Applications ...€¦ · 2007 JavaOneSM Conference | LAB-4410 | 3 How Instructor-Led Hands-on Lab Works Instructors will guide you through

2007 JavaOneSM Conference | LAB-4410 | 19

Configure your performance test● This is done using user created configuration file● The configuration file is in XML format● Configurable parameters

● Client JVM options● Ramp-Up, Steady-State and Ramp-Down times● Number of threads (simulated users)● User defined properties e.g. Homepage URL● Server host and port number● etc.

Page 20: LAB-4410: Benchmarking and Profiling Web 2.0 Applications ...€¦ · 2007 JavaOneSM Conference | LAB-4410 | 3 How Instructor-Led Hands-on Lab Works Instructors will guide you through

2007 JavaOneSM Conference | LAB-4410 | 20

Configure your performance test

● Open Netbeans IDE● Follow lab document index.html● Inspect run.xml

Page 21: LAB-4410: Benchmarking and Profiling Web 2.0 Applications ...€¦ · 2007 JavaOneSM Conference | LAB-4410 | 3 How Instructor-Led Hands-on Lab Works Instructors will guide you through

2007 JavaOneSM Conference | LAB-4410 | 21

Run performance test● The driver class is used by Faban driver

framework to run performance test● The driver runs on a single JVM

● Multiple driver JVM configurations are possible (out of scope for the lab)

● Multiple driver machines configurations are possible (out of scope for the lab)

● Driver can be run as standalone Java program or from ANT scripts● Driver class: com.sun.faban.driver.core.Master

Page 22: LAB-4410: Benchmarking and Profiling Web 2.0 Applications ...€¦ · 2007 JavaOneSM Conference | LAB-4410 | 3 How Instructor-Led Hands-on Lab Works Instructors will guide you through

2007 JavaOneSM Conference | LAB-4410 | 22

Run performance test● Open Netbeans IDE● Follow lab document index.html

Page 23: LAB-4410: Benchmarking and Profiling Web 2.0 Applications ...€¦ · 2007 JavaOneSM Conference | LAB-4410 | 3 How Instructor-Led Hands-on Lab Works Instructors will guide you through

2007 JavaOneSM Conference | LAB-4410 | 23

DEMOConfigure and run performance test

Page 24: LAB-4410: Benchmarking and Profiling Web 2.0 Applications ...€¦ · 2007 JavaOneSM Conference | LAB-4410 | 3 How Instructor-Led Hands-on Lab Works Instructors will guide you through

2007 JavaOneSM Conference | LAB-4410 | 24

Analyze performance test results● Performance test results are collected in results

directory as defined by configuration file● The test report files is created in XML format

● summary.xml provides summary report● detail.xml provides details for each user interaction● driver.log provides console output of driver machine;

helpful for client side errors

Page 25: LAB-4410: Benchmarking and Profiling Web 2.0 Applications ...€¦ · 2007 JavaOneSM Conference | LAB-4410 | 3 How Instructor-Led Hands-on Lab Works Instructors will guide you through

2007 JavaOneSM Conference | LAB-4410 | 25

Analyze performance test results● Open Netbeans IDE● Follow lab document index.html● Inspect summary.xml

Page 26: LAB-4410: Benchmarking and Profiling Web 2.0 Applications ...€¦ · 2007 JavaOneSM Conference | LAB-4410 | 3 How Instructor-Led Hands-on Lab Works Instructors will guide you through

2007 JavaOneSM Conference | LAB-4410 | 26

Agenda With Section Highlights

● Examining jMaki Stockportfolio application● How to write your Benchmark Driver● Learn Server Side Tunings● Optional exercises:

● Profiling● Debugging● Faban Framework

Page 27: LAB-4410: Benchmarking and Profiling Web 2.0 Applications ...€¦ · 2007 JavaOneSM Conference | LAB-4410 | 3 How Instructor-Led Hands-on Lab Works Instructors will guide you through

2007 JavaOneSM Conference | LAB-4410 | 27

Server Side Tunings● Server side tunings are done on server which is

hosting the Web 2.0 application● Server side tunings can be done on

● JVM on which application is running● Application server on which application is deployed● Operating System of the server machine (not covered

in this lab)● Server side tunings affect runtime behavior of the

application and its performance● Most tunings require application server restart

Page 28: LAB-4410: Benchmarking and Profiling Web 2.0 Applications ...€¦ · 2007 JavaOneSM Conference | LAB-4410 | 3 How Instructor-Led Hands-on Lab Works Instructors will guide you through

2007 JavaOneSM Conference | LAB-4410 | 28

Server Side Tunings● JVM tunings

● -server : This setting starts the JVM in server mode. ● -Xms1g : This is minimum heap size value for the

JVM. ● -Xmx1g : This value sets maximum heap size for the

JVM. ● -Xss128k : This value represents stack size for the

JVM.

Page 29: LAB-4410: Benchmarking and Profiling Web 2.0 Applications ...€¦ · 2007 JavaOneSM Conference | LAB-4410 | 3 How Instructor-Led Hands-on Lab Works Instructors will guide you through

2007 JavaOneSM Conference | LAB-4410 | 29

DEMOConfigure and run performance test with optimized server JVM tunings

Page 30: LAB-4410: Benchmarking and Profiling Web 2.0 Applications ...€¦ · 2007 JavaOneSM Conference | LAB-4410 | 3 How Instructor-Led Hands-on Lab Works Instructors will guide you through

2007 JavaOneSM Conference | LAB-4410 | 30

Server Side Tunings● Application server tunings

● Keep-Alive tunings● Thread Count = 1 : This value represents number of

threads that will be used to do Keep Alive activities such as closing idle connections.

● Max Connections = 32000 : This value is maximum number of open HTTP connections that the server can support.

● Time Out = 30 : This value represents number of seconds connections can run idle before getting closed.

Page 31: LAB-4410: Benchmarking and Profiling Web 2.0 Applications ...€¦ · 2007 JavaOneSM Conference | LAB-4410 | 3 How Instructor-Led Hands-on Lab Works Instructors will guide you through

2007 JavaOneSM Conference | LAB-4410 | 31

Server Side Tunings● Application server tunings

● HTTP connection pool tunings● Thread Count = 128 : This value represents maximum

number of request processing threads for the HTTP service.

● Initial Thread Count = 128 : This value represents minumum number of request processing threads for the HTTP service.

● Thread Increment = 10 : This value represents number of threads used to resize the thread pool.

Page 32: LAB-4410: Benchmarking and Profiling Web 2.0 Applications ...€¦ · 2007 JavaOneSM Conference | LAB-4410 | 3 How Instructor-Led Hands-on Lab Works Instructors will guide you through

2007 JavaOneSM Conference | LAB-4410 | 32

DEMOConfigure and run performance test with optimized application server tunings

Page 33: LAB-4410: Benchmarking and Profiling Web 2.0 Applications ...€¦ · 2007 JavaOneSM Conference | LAB-4410 | 3 How Instructor-Led Hands-on Lab Works Instructors will guide you through

2007 JavaOneSM Conference | LAB-4410 | 33

Summary

● Glassfish server & jMaki framework for Web 2.0 development

● Web 2.0 benchmark driver using Faban● Server side performance characteristics

Page 34: LAB-4410: Benchmarking and Profiling Web 2.0 Applications ...€¦ · 2007 JavaOneSM Conference | LAB-4410 | 3 How Instructor-Led Hands-on Lab Works Instructors will guide you through

2007 JavaOneSM Conference | LAB-4410 | 34

For More Information

● BOF-6876 Ajax and Web 2.0 Performance Roundtable

● http://glassfish.dev.java.net● http://ajax.dev.java.net● http://faban.sunsource.net● http://www.netbeans.org/

Page 35: LAB-4410: Benchmarking and Profiling Web 2.0 Applications ...€¦ · 2007 JavaOneSM Conference | LAB-4410 | 3 How Instructor-Led Hands-on Lab Works Instructors will guide you through

2007 JavaOneSM Conference | LAB-4410 | 35

Q&A

Page 36: LAB-4410: Benchmarking and Profiling Web 2.0 Applications ...€¦ · 2007 JavaOneSM Conference | LAB-4410 | 3 How Instructor-Led Hands-on Lab Works Instructors will guide you through

2007 JavaOneSM Conference | LAB-4410 | 36

Finishing Up

● Fill up the survey form● Log out

Page 37: LAB-4410: Benchmarking and Profiling Web 2.0 Applications ...€¦ · 2007 JavaOneSM Conference | LAB-4410 | 3 How Instructor-Led Hands-on Lab Works Instructors will guide you through

2007 JavaOneSM Conference | LAB-4410 |

LAB-4410

LAB-4410: Benchmarking and Profiling Web 2.0 Applications for Performance

Deep Singh, Kim LiChong, Suveen Nadipalli, Rahul Biswas and Venkana Goudar

Staff members, Enterprise Java Performance GroupSun Microsystems, Inchttp://www.sun.com