25
Thu, Apr
0 New Articles

Stress-testing Web Applications

Web Languages
Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

With the wide breadth of Web application servers available today, you need to have some facility for discerning which products are the fastest. Further, once you set up a Web application, you want to be sure that the Web site continues to perform adequately. There are a number of products available that allow you to stress-test your Web server and your Web applications. Many of these products are expensive, but the one that I’m going to tell you about is free. In fact, it is so free that it is an open source project known as JMeter, which is available from the Apache Software Foundation.

JMeter is an open source all-Java product that allows you to automatically test the performance of Web applications. Basically, JMeter iteratively performs URL requests to one or more Web sites and accumulates the response data for later review. JMeter also provides a number of graphical charts, such as bar charts and line graphs, so that you can more easily review the test results.

Installation

You can get your copy of JMeter from http://java.apache. org/jmeter/index.html. You can read more about JMeter on its home page but, for now, select the Download hyperlink. That will take you to the Apache JMeter Distribution page, where you select the ApacheJMeter_1.5.zip hyperlink to begin the download. Once the program is downloaded, use a version of the zip compression utility (a trial of WinZip is available at www.winzip.com) to extract the ApacheJMeter_1.5.zip file. The zip utility will create a JMeter directory with subdirectories of bin, docs, and src. Notice I said it’ll create a directory named src; that stands for source, and, yes, JMeter is an open source product, so you get JMeter’s complete source. If you look in the bin directory, you’ll see the jmeter.bat file. This is the file you must execute to start JMeter. If you execute that batch file without the next couple of configuration steps, you’ll probably get Java errors. That’s because JMeter requires that you have Sun’s JavaMail on your system and that it’s qualified on the Java classpath environment variable. Therefore, if you do not yet have JavaMail, you’ll need to download it. You can download the JavaMail zip archive from http://java. sun.com/products/javamail. When you extract the zip, you will have a directory called javamail-1.1.3, under which you’ll find a file called mail.jar. The easiest way to add mail.jar to your classpath is to edit the jmeter.bat file and append the full qualification of


mail.jar to the -cp option of the Java command. So java -cp %CLASSPATH%; ApacheJMeter.jar becomes something like java -cp %CLASSPATH%; ApacheJMeter.jar;D:Javajavamail-1.1.3mail.jar, where D:Java is the drive letter and path you extracted the JavaMail file to.

You’ll also have to make sure that your PC has the Java Development Kit (JDK)
1.2 or 1.3 installed, because JMeter uses the Java Foundation Classes (JFC) GUI components, new with JDK 1.2. You can get the latest JDK from http://java.sun.com. One final note: You may have to increase the size of the environment space in the DOS session that the jmeter.bat file runs in. Many 95/98 systems do not have enough environment space allocated to accommodate the environment variables added by jmeter.bat.

Gauging Performance

JMeter comes with a Windows batch file called jmeter.bat and a UNIX/Linux shell script called jmeter.sh, which you can use to bring up the JMeter GUI. But before you attempt to use the startup command, be sure to do the minor setup and configuration steps covered earlier. Given appropriate configuration, however, the JMeter script should bring up the JMeter GUI, from which you can start stress-testing Web sites. You can use JMeter to test Web servers in one of three ways: by entering a URL, through Java Database Connectivity (JDBC) connections, or by hitting an unlimited number of HTTP requests with a variety of parameter settings. The easiest way to become familiar with JMeter is to use its Sampler panel’s default of Simple HTTP Tester, as shown in Figure 1, and then qualify your Web site in the URL prompt. The Timers panel, shown at the bottom of the screen in Figure 1, lets you select how long of a delay, in milliseconds, you want between the JMeter hits to those Web sites. You can opt to use a random delay with a Gaussian distribution (which uses empirical rules of standard deviations to approximate real-world Web access), a random delay and a uniform distribution, or simply a constant delay. If you don’t know what a Gaussian distribution is, simply use a constant delay.

You can watch the graphical results of the JMeter data collection in a variety of dynamic screen formats such as spline curves or dot plots. I find it more convenient, however, to use the JMeter option of writing the results to a file and then reviewing them later. Note that JMeter also has options that allow you to review the Web application’s textual response to JMeter’s automated URL request, and you can even have the results emailed to you (which is a nice way to automate performance tests on a production Web site). At any rate, what I suggest is that you write the samples to a data file. To write the samples, select the Run tab and then type the name of an output file in the Actions panel (see Figure 2). I suggest that you put the file in JMeter’s testsamples subdirectory and use a suffix of .data. After you’ve clicked the Open button, you can finally start collecting data by selecting Start in the Run menu. Let JMeter collect data for 5 to 10 minutes before stopping it with the use of the Control key and period (Control-.) accelerator keystroke. (You may find that you have to do this several times before JMeter acknowledges the termination request.) At this point, you can write the sample data to your file by clicking on Flush and then Close on the Actions panel.

With the data written to a file, you can review the results graphically by selecting the Analyze Data File menu option in the Reports menu. After you’ve qualified the data file—you can use the browse dialog to select your data file—a nice graph of the test results, such as the one shown in Figure 3 (page 64), will be displayed. Note that the black line charts the number of milliseconds it took for Midrange Computing’s Web site to respond to the 81 home page requests.

WebLogic vs. Tomcat

The Simple HTTP Tester default of the Samplers panel (see Figure 1) allows you to test a single Web site using only one URL and query string. But, if you choose the Advanced HTTP Tester twirly option, then you can qualify as many URLs as you want. You might


want to test the same Web site but with varied query strings. You can configure JMeter to iterate through a list of server programs, to simulate random use of an application. But you can also test several Web application servers and then graphically display a comparison. To test JMeter’s comparison capabilities, I ran a test comparing the Apache Software Foundation’s Tomcat with BEA’s WebLogic, the result of which is shown in Figure 4. The black lines in Figure 4 show the milliseconds it took for WebLogic to respond to the 342 JavaServer Page (JSP) requests whereas the blue line shows Tomcat’s response time. A quick look at Figure 4 suggests that, for this test case, the response time of Tomcat and WebLogic are relatively similar. To set up that test, I had to create the Tomcat and WebLogic Web Page Test Samples, shown in Figure 5, by clicking on the Create New Test Sample icon (the sheet of paper with the little snowflake on it). Clicking on that icon brought up the URL Test Parameters dialog, shown in the center of Figure 5. The URL qualified a simple JSP called JSP400.jsp (see “Bridge the Gap to Java with JSP,” in the May 2000 issue of Midrange Computing) that retrieves a JDBC result set of approximately a dozen records. Had I used a JSP, servlet, or CGI that required arguments, I could have specified a list of query parameters with this panel. Note that on both the Tomcat and WebLogic test samples, I selected the Interleave option. By doing so, JMeter alternates hits on each Web application server. That is, first it will connect to the Tomcat server and then to the WebLogic server and then back to the Tomcat server, and so on. After that, I executed the test in the same way I did using the Simple HTTP Tester example.

Beyond JMeter

There are other products available for stress-testing Web sites, but JMeter is free. If you find that JMeter’s graphical displays aren’t sophisticated enough, you don’t have to buy a different product; you can just extend JMeter. Perhaps the coolest thing about JMeter is that, like the Apache Software Foundation’s flagship Apache product, it’s extensible. JMeter was developed using the standard object-oriented programming technique of inheritance. JMeter has five extensible object types: Timers, SamplerControllers, Samplers, TestSamples, and Visualizers. And, because of the nature of the Apache license, other developers will undoubtedly be creating extensions that will become available to everyone. Regardless, the base JMeter tool is a handy way to add some controlled stress to your job as a Web developer.

REFERENCES AND RELATED MATERIALS

• Apache JMeter Web page: http://java.apache.org/jmeter/index.html

• BEA Systems Web page: www.beasys.com

• Jakarta Tomcat Web page: http://jakarta.apache.org/tomcat

• Sun’s JavaMail API Web page: http://java.sun.com/products/javamail


Stress-_testing_Web_Applications04-00.png 497x422

Figure 1: The easiest way to use JMeter is to ask it to hit one URL at specified intervals.


Stress-_testing_Web_Applications05-00.png 506x430

Figure 2: The data that JMeter collects can be viewed dynamically in a GUI or saved to a file for later analysis.


Stress-_testing_Web_Applications06-00.png 497x277

Figure 3: The data from JMeter collection files can be displayed in a graph.

Figure 4: By using JMeter’s Advanced HTTP Tester, you can compare the performance of several Web application servers.


Stress-_testing_Web_Applications06-01.png 497x361

Stress-_testing_Web_Applications07-00.png 501x622

Figure 5: JMeter’s URL Test Parameters lets you set up any number of URLs with optional query strings.


Don Denoncourt

Don Denoncourt is a freelance consultant. He can be reached at This email address is being protected from spambots. You need JavaScript enabled to view it..


MC Press books written by Don Denoncourt available now on the MC Press Bookstore.

Java Application Strategies for iSeries and AS/400 Java Application Strategies for iSeries and AS/400
Explore the realities of using Java to develop real-world OS/400 applications.
List Price $89.00

Now On Sale

BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$0.00 Raised:
$

Book Reviews

Resource Center

  • SB Profound WC 5536 Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application. You can find Part 1 here. In Part 2 of our free Node.js Webinar Series, Brian May teaches you the different tooling options available for writing code, debugging, and using Git for version control. Brian will briefly discuss the different tools available, and demonstrate his preferred setup for Node development on IBM i or any platform. Attend this webinar to learn:

  • SB Profound WP 5539More than ever, there is a demand for IT to deliver innovation. Your IBM i has been an essential part of your business operations for years. However, your organization may struggle to maintain the current system and implement new projects. The thousands of customers we've worked with and surveyed state that expectations regarding the digital footprint and vision of the company are not aligned with the current IT environment.

  • SB HelpSystems ROBOT Generic IBM announced the E1080 servers using the latest Power10 processor in September 2021. The most powerful processor from IBM to date, Power10 is designed to handle the demands of doing business in today’s high-tech atmosphere, including running cloud applications, supporting big data, and managing AI workloads. But what does Power10 mean for your data center? In this recorded webinar, IBMers Dan Sundt and Dylan Boday join IBM Power Champion Tom Huntington for a discussion on why Power10 technology is the right strategic investment if you run IBM i, AIX, or Linux. In this action-packed hour, Tom will share trends from the IBM i and AIX user communities while Dan and Dylan dive into the tech specs for key hardware, including:

  • Magic MarkTRY the one package that solves all your document design and printing challenges on all your platforms. Produce bar code labels, electronic forms, ad hoc reports, and RFID tags – without programming! MarkMagic is the only document design and print solution that combines report writing, WYSIWYG label and forms design, and conditional printing in one integrated product. Make sure your data survives when catastrophe hits. Request your trial now!  Request Now.

  • SB HelpSystems ROBOT GenericForms of ransomware has been around for over 30 years, and with more and more organizations suffering attacks each year, it continues to endure. What has made ransomware such a durable threat and what is the best way to combat it? In order to prevent ransomware, organizations must first understand how it works.

  • SB HelpSystems ROBOT GenericIT security is a top priority for businesses around the world, but most IBM i pros don’t know where to begin—and most cybersecurity experts don’t know IBM i. In this session, Robin Tatam explores the business impact of lax IBM i security, the top vulnerabilities putting IBM i at risk, and the steps you can take to protect your organization. If you’re looking to avoid unexpected downtime or corrupted data, you don’t want to miss this session.

  • SB HelpSystems ROBOT GenericCan you trust all of your users all of the time? A typical end user receives 16 malicious emails each month, but only 17 percent of these phishing campaigns are reported to IT. Once an attack is underway, most organizations won’t discover the breach until six months later. A staggering amount of damage can occur in that time. Despite these risks, 93 percent of organizations are leaving their IBM i systems vulnerable to cybercrime. In this on-demand webinar, IBM i security experts Robin Tatam and Sandi Moore will reveal:

  • FORTRA Disaster protection is vital to every business. Yet, it often consists of patched together procedures that are prone to error. From automatic backups to data encryption to media management, Robot automates the routine (yet often complex) tasks of iSeries backup and recovery, saving you time and money and making the process safer and more reliable. Automate your backups with the Robot Backup and Recovery Solution. Key features include:

  • FORTRAManaging messages on your IBM i can be more than a full-time job if you have to do it manually. Messages need a response and resources must be monitored—often over multiple systems and across platforms. How can you be sure you won’t miss important system events? Automate your message center with the Robot Message Management Solution. Key features include:

  • FORTRAThe thought of printing, distributing, and storing iSeries reports manually may reduce you to tears. Paper and labor costs associated with report generation can spiral out of control. Mountains of paper threaten to swamp your files. Robot automates report bursting, distribution, bundling, and archiving, and offers secure, selective online report viewing. Manage your reports with the Robot Report Management Solution. Key features include:

  • FORTRAFor over 30 years, Robot has been a leader in systems management for IBM i. With batch job creation and scheduling at its core, the Robot Job Scheduling Solution reduces the opportunity for human error and helps you maintain service levels, automating even the biggest, most complex runbooks. Manage your job schedule with the Robot Job Scheduling Solution. Key features include:

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • LANSAWhen it comes to creating your business applications, there are hundreds of coding platforms and programming languages to choose from. These options range from very complex traditional programming languages to Low-Code platforms where sometimes no traditional coding experience is needed. Download our whitepaper, The Power of Writing Code in a Low-Code Solution, and:

  • LANSASupply Chain is becoming increasingly complex and unpredictable. From raw materials for manufacturing to food supply chains, the journey from source to production to delivery to consumers is marred with inefficiencies, manual processes, shortages, recalls, counterfeits, and scandals. In this webinar, we discuss how:

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • Profound Logic Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application.

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: