In Jef Raskin’s excellent book, The Humane User Interface, he discusses how the human brain is able to perform many tasks simultaneously while only having the ability to focus on one conscious thought at a time. Being able to process information and analyze it intelligently is crucial to our ability to solve problems, but once we have learned how to deal with a particular situation, just as vital is our ability to remember and recall the response without thinking.
A couple of years ago I presented Take a load off! Load testing your Oracle Apex or JDeveloper web applications at OOW and AUSOUG. I can't recommend enough the importance of stress testing your web applications, it's saved my bacon a number of times. Frequently as developers, we develop under a single user (developer) model where concurrency issues are easily avoided. When our programs hit production, with just 1 more user, suddenly our programs grind to a halt or fall over in bizarre places. Result, pie on developers' faces, users' faith in new technologies destroyed, and general gnashing of teeth all round. Some simple stress and load tests can head off problems way before they hit production.
(For the remainder of this post I'll infer "stress testing" and "load testing" as the same thing, though strictly speaking one tests for your application falling over, and the other how fast it responds under load)
So how to go about stress testing a web application?
There are numerous tools available to stress test web applications, paid and free. This post will look at the setup and use of Apache's JMeter, my tool of choice, mainly because it is free! ... to undertake a very simple stress test. Apache JMeter is available here, version 2.3.3 at time of writing.
On starting JMeter (<jmeter-home>/bin/jmeter.bat on Windows) you'll see the following:
Creating a Thread Group
From here what we want to do is set up a Thread Group that simulates a number of users (concurrent sessions), done by right clicking the Test Plan node -> Thread Group option. This results in:
As you can see the Thread Group allows us to set a number of threads to simulate concurrent users/sessions, loop through tests and more.
Creating HTTP Requests
From here we can create a number of HTTP requests (Test Plan node right click -> Add -> Sampler -> HTTP Requests) to simulate each HTTP request operation (Get, Post etc), HTTP headers, payloads and more. However in a standard user session between server and browser there can be a huge array of these requests and configuring these HTTP requests within JMeter would be a major pain.
Configuring the HTTP Proxy Server
However there's an easier way. Apache JMeter can work as a proxy between your browser and server and record a user's HTTP session, namely the individual HTTP requests, that can be re-played in a JMeter Thread Group later.
To set this up instead right click the Workbench node, Add -> Non-Test Elements -> HTTP Proxy Server:
To configure the HTTP Proxy Server do the following:
* Port – set to a number that wont clash with an existing HTTP server on your PC (say 8085)
* Target Controller – set to "Test Plan > Thread Group". When the proxy server records the HTTP session between your browser and server, this setting implies the HTTP requests will be recorded against the Thread Group you created earlier, so we can reuse them later
* URL Patterns to include – a regular expression based string that tells the proxy server which URLs to record, and those to ignore. To capture everything set it to .* (dot star). Be warned that during recording however, if you use your browser for anything else but accessing the server you wish to stress test, JMeter will also capture that traffic. This includes periodic refreshes by web applications such as Gmail or Google Docs that you don't even initiate; I'm pretty sure when replaying your stress test, Google would prefer you not to stress test their infrastructure for them; stick to your own for now ;-)
The end HTTP Proxy Server setting will look something like this:
You'll note the HTTP Proxy Server has a Start button. We can't use this just yet.
Configuring your Browser
In order for the JMeter HTTP Proxy Server to capture the traffic between your server and browser, you need to make some changes to your browser's configuration. I'm assuming you're using Firefox 3 in the following example, but same approximate steps are needed for Internet Explorer.
Under Firefox open the Tools -> Options menu, then Advanced icon, Network tab, Settings button which will open the Connection Settings dialog.
In the Connection Settings dialog set the following:
* Select the Manual proxy configuration radio button
* HTTP Proxy – localhost
* Port – 8085 as per the JMeter HTTP Proxy Server option we set earlier
* No Proxy for – ensure that localhost and 127.0.0.1 aren't in the exclusion list
The above setup makes an assumption that the server you want to access is accessibly without a further external proxy required.
Recording your HTTP session
Once the browser's proxy is setup, to record a session between the browser and server do the following:
1) In Apache JMeter hit the Start button on the HTTP Proxy Server page
2) In your browser enter the URL of the first page in the application you want to stress test
Thereafter as you navigate your web application, enter data and so on, JMeter will faithfully record each HTTP request between the browser in server against your Thread Group. This may not be immediately obvious, but expand the Thread Group and you'll see each HTTP request made from the browser to server:
As can be seen, even visiting 1 web page can generate a huge amount of traffic. Ensure to stop recording the HTTP session by selecting the Stop button in the JMeter HTTP Proxy Server page.
Configuring the Thread Group for replay
Once you've recorded the session in the Thread Group there are a couple of extra things we need to achieve.
For web application's that use Cookies and session IDs (JDeveloper's ADF uses a JSessionID for tracking sessions) to track each unique user session, we cannot replay the exact HTTP request sequence with the server through JMeter, as the session ID is pegged to the recorded session, not the upcoming stress test sessions.
To solve this in JMeter right click the Thread Group -> Add -> Config Element -> HTTP Cookie Manager. This will be added as the last element to the Thread Group. I usually move it to the top of the tree:
Next we need to configure the Thread Group to show us the results of the stress test. There are a number of different ways to do this, from graphing the responses, to showing the raw HTTP responses. In this post we'll take the later option.
Right click the Thread Group -> Add -> Listener -> View Results in Tree, which will add a View Results in Tree node to the end of the Thread Group:
Finally save the Thread Group by selecting it in the node tree, then File -> Save.
Running the Thread Group
To commence your first stress test run, it's best to leave the number of spawned sessions to 1, just to see the overall test will work in it's most basic form. The default Thread Group number of threads is set to 1, so there is no need to make a change to do this.
To run the test, simply select the Run menu -> Start. On running the Thread Group, you'll see the top right of JMeter has a little box that tells if it's still running, and the number of tests to go vs total number of tests:
Once the tests are complete, this indicator will grey out.
We can now visit the View Results Tree:
This shows the HTTP requests that were sent out and on selecting an individual request, you see the raw HTTP request and the actual response. You'll note the small green triangles showing a successful HTTP 200 result. If different HTTP errors occur the triangles show different colours. Also remember that sometimes application errors don't perculate up to the HTTP layer in your web application, so you should check your application's logs too (in the case of a JEE application, this will be your container's internal logs).
Running a Stress Test
The obvious step from here is to change the Thread Group number of threads to a higher number.
From here take time out to explore the other features in JMeter. It includes a wide range of features that in particular make it useful for regression testing.
Caveats
Firstly remember when doing this you're not only stress testing your application, your stress testing a server, potentially stress testing databases, stress testing your networks and so on. Therefore you can have an affect on anybody sharing those resources. "Hard core" stress tests should be on separate infrastructure, after hours, aiming for as little impact on those around you!
Also keep in mind, besides seeing your application fall over at 2 users, 10 users, 100 users, which is an important test, try to be realistic about your stress tests. Stress testing you're brand-new-application to a 1 million concurrent users is probably not being realistic. How many concurrent user requests do you really expect and what response times do you need? Normally when I ask managers this question they'll answer with, "oh we have 1000 concurrent users, the application must support that many at any one time". However what they really mean is the application has 1000 users, potentially all logged into the application (ie. sessions) at the same time, but not necessarily hitting the server with HTTP requests at any onetime.
At the Project Portfolio Management Summit in California on June 15, Compuware unveiled a juiced-up version of its IT portfolio management solution, Changepoint, identifying agile development and delivery as key components of increasing value to customers over the next 12 likely-recessionary months.
Sun Microsystemshas announced that Sun(TM) Studio 12 Update 1, a major upgrade to its software compiler and tools technology, is freely available for download at http://developers.sun.com/sunstudio. Sun Studio software provides an advanced suite of tools for the Solaris(TM) 10 Operating System (OS), OpenSolaris(TM), the next generation of the Solaris OS, and leading Linux platforms, including parallelizing compilers, powerful debuggers, advanced thread and performance analysis tools, and highly-tuned libraries that help simplify the creation of high-performance applications and provide an optimized development environment for the latest multi-core x86 and SPARC(R)-based systems.
Imagine a data center chock full of heterogeneous equipment and running hot. That should be an easy exercise since they all are. But now it’s important to stop the waste and reduce energy consumption. Where do you start? Well, it might be nice to whittle the problem down to size and figure out what in that sea of servers and whatnot are the biggest offenders.
OpenXava 3.1.3 is a framework to develop Java Enterprise applications in a different way: OpenXava avoids MVC. It's a JPA Application Engine in that you provide only your POJOs annotated with JPA and you obtain an application ready for production.
Boulder, CO. Managed Methods Inc. (www.managedmethods.com ) the leader in SOA (Service Oriented Architecture) visibility and SOA runtime governance today announced the availability of their SOA management and runtime governance product JaxView 5.0. While providing full support for SOA and Web service management for the IT operations, JaxView 5.0 expanded runtime policy enforcement features such as expanded service virtualization and visibility into intra-container message communication.
The Google Apps Reseller program includes resellers, consultants and independent software vendors that sell, service and customize Google Apps Premier Edition for their customers. Etelos received training, support and deployment services from Google, as well as access to APIs for integrating Google Apps into their customers' business operations. Etelos is able to retain a close relationship with their customers in order to provide additional service and support. The businesses receiving Google Apps will benefit from the additional attention to their specific needs. For more information on Etelos marketplace and syndication programs, please visit www.etelos.com and to learn more about the Google Apps Reseller program, go to http://www.google.com/a.
We now have just 6 days until the start of SYS-CON's iPhone Developer Summit in New York's Roosevelt Hotel. During the now two day event, there will be nine presenters as well as exhibitors, such as Sybase. Now for the next two presenters on my list...
Dell now has ~$10 billion in its jeans to spend on an acquisition or two. It raised another billion this week selling bonds. That’s the second time in two months it’s sold debt, not something it’s done much of in years past. It also has IBM’s poached M&A chief David Johnson, but since IBM sued him to enforce his non-compete he’s off “studying the company” while a court decides if and when he can practice his skills.
Introduced in 1995, Java has firmly established itself as a mature mainstream programming language for enterprises. The Java platform security model has evolved over the years to meet new requirements, and today enterprise Java developers have a large number of APIs and services to choose from to fulfill their security needs.
A global, multiple data center, open-source test bed for the advancement of cloud computing research, Open Cirrus was started last summer by HP, Intel Corp. and Yahoo! Inc. The goal is to “promote open collaboration among industry, academia and governments by removing the financial and logistical barriers to research in data-intensive, Internet-scale computing,” the founders say.
If Oracle hasn’t been exactly forthcoming with its reportedly three-year plan for Sun, it’s because it’s still trying to figure out exactly what it is. Like what it’s really going to do about the Sparc chip, for instance. Oracle CEO Larry Ellison, who’s orchestrating things even if co-president Chuck Phillips is nominally in charge of integration from the Oracle side, is reportedly determined to exploit the cloud phenomenon and turn Oracle-Sun into a cloud-based company by making sure he’s got Oracle’s whole software stack on network-based appliances built by Sun.
Last week while EMC was distracting everybody by one-upping NetApp in a hostile play for Data Domain, Micro Focus was saying sotto voce that a mystery company, described as a financial buyer, had trumped its $75 million cash offer for Borland.
As the theme tune to the classic 1984 Ghostbusters movie goes, "If there's something strange, in your neighborhood, Who ya gonna call?", I am left wondering what we'll all be singing (shouting?) when something goes wrong in our cloud world. When you've got your whole business in the cloud and there is an outage, just what happens to your bottom line? What happens to your customers? What do you do?
According to Casey Coffman, CEO of Coffman Group (www.coffmangroup.com), "No one with any intelligence will continue to buy this stuff (social media) without the resources to track sales conversions. We want the real ROI, not the one that marketers invented to continue their spending with CFOs. Valerie Jennings, CEO of Jennings (www.jenningspr.net), and I know with the right social media marketing and proprietary social media selling process, we will combine the best of both worlds," explained Coffman.
"This was another amazing JavaOne," wrote James Gosling in his first post-conference blog. "It was also the weirdest: between the Oracle situation, the global meltdown, and the financial situation, it was very different." Sun nearly panicked, Gosling admits, fearing that "no one would show up. Almost every company that usually sends a crowd of people to JavaOne had travel restrictions that meant that few could attend." But all went well in the end.
IBM has announced new products and services to help organizations more effectively align their business strategies with their investments in software. The new offerings are designed to help clients lower costs and reduce risks by providing increased visibility into the status of software projects and the ability to monitor and improve the performance of these investments. Additionally, IBM will be previewing several of its software delivery products in a cloud environment, giving clients an early look at how they can minimize costs while freeing up resources for investments in new projects.
For the past 8 years I've been a great fan, user and evangelist of wikis. Wave picks up the original idea from old-time Smalltalker Ward Cunningham and moves it 25 years into the present. Wave is what Ozzie's Groove always wanted to be, but Ozzie missed the Internet, so it found a good home with Microsoft. Wave is the Facebook for more closed groups, but also the MySpace for all the social stuff you want to share with your friends, but may be not with the world.
In the 21st century, the U.S. Labor Dept. predicts that today's learner will have over 10 jobs by the time they are 38. Being able to adapt to changing conditions in your job status and the status of your buyers is an important strength in 2009.
A couple of patterns that could cause Java heap exhaustion were identified from years of research at IBM. One interesting scenarios was observed when Java applications generate excessive amount of finalizable objects whose classes have non-trivial Java finalizers. A Java finalizer performs finalization tasks for an object. It’s the opposite of a Java constructor, which creates and initializes an instance of a Java class.
An ostensibly priggish Chinese government has mandated that all PCs sold in the country ship with a special piece of anti-pornography censorship software starting July1. It’s being received as hard-core government control over what the Chinese access over the Internet.
Microsoft and Sun recently announced their Open Source Project Stonehenge at the JavaOne conference. Stonehenge is a reference implementation that shows how to bridge the two major development platforms Java and .NET using Web Services. This initiative definitely puts the spotlight on heterogeneity and the challenges that come with it. Interoperability on the platform level is [...] Related posts:
At JavaOne, Larry Ellison has made some very encouraging statements about Oracle’s commitments to Java, JavaFX, and the mobile developer market. It is certainly good news that Oracle (i.e., Larry) sees the significance of the Java platform in its integrality. However, there are many misunderstandings about the relationship between Java, JavaFX, and Android that even confuse the new Java owner. Here are some clarifications.
New product announcements this year included JavaFX 1.2, which includes new cross platform User Interface (UI) controls, faster application start-up, streaming media support and other performance enhancements across desktop, browser and mobile.