How to Load Test Flex Application Using JMeter
Two weeks ago I got responsibility to load test the web application of the company where I work using JMeter.
It’s not the first time I heard about JMeter, because about two years ago I was involved in a large project that demands high availability and high number of concurrent users at the same time (talk about more than 3,000 branches nationwide).
However, it was my friend who was assigned to explore the capabilities of JMeter back then. I’m not sure how far he went with the load testing, and what was the problem with JMeter, but we end up utilizing IBM Rational Performance Tester.
Unlike testing normal web application (that most likely involves HTTP standard requests such GET, POST, PUT, and DELETE), Flex application may use it’s BlazeDS web messaging to connect to the back-end server, this means it involves passing AMF binary files in the process.
Fortunately, JMeter has the ‘Recording Test’ capability to the rescue and simplify our life! 😀
The idea is to create a proxy server that will run in the middle of the browser and the application server. This way the JMeter will record all the HTTP requests and files passed to the application server, and also their result. Sweeet!
So how to do that? Just follow the steps below:
Setup the Thread Group
1. Run JMeter
2. Right click on Test Plan > Add > Threads (Users) > Thread Group
3. Rename the Thread Group to ‘Load Test 1’
4. Set the Number of Threads (Users) field to the number of load test user simulation you want (i.e: set to 25).
5. Right click on ‘Load Test 1’ > Add > Listener > Aggregate Graph
6. Repeat step 5, this time choose Aggregate Report
7. Repeat step 5, this time choose Summary Report
8. Repeat step 5, this time choose View Results Tree
Setup the HTTP Proxy Server
1.Right click on WorkBench > Add > Non-Test Elements > HTTP Proxy Server
2. Set the port to available open port in your PC (i.e.: set to 8989)
3. Check ‘Redirect Automatically’
4. Type ‘ .* ‘ in the include field.
5. Set Target Controller to Test Plan > Load Test 1
6. Click Start to start the Proxy Server
Setup the Browser
1. Run the browser, and set the connection properties to use proxy.
2. Set it to localhost and the port you set above.
3. Browse the Flex application and try to use it as usual.
4. The JMeter should capture the HTTP request operations you made to the server.
5. Press Stop on the HTTP Proxy Server to stop the recording.
Do the Load Test
1. Now we have the example of HTTP request operations, click the Load Test 1 Test Plan.
2. Press Ctrl+R to run the load test, you should see the green indicator on the top right that it’s running the tests.
3. Check the Test Results in all four Listeners you added earlier.
This steps were proven working in my case and I use Apache JMeter 2.4 r961953. If they don’t then try to put some comments below. Happy load testing! 😀