Load testing AJAX with JMeter
Testing normal AJAX (using DWR) connections with JMeter is reasonably straight forward. Note that if you are using Spring’s CharacterEncodingFilter and force UTF-8 (since JMeter does not set the character encoding), POST parameters will not be read by the DWR servlet, in this case either disable your filter or use a GET for your AJAX requests and keep the parameter size in check.
Setup a POST to login to your application (or whatever is necessary to establish a session).
GET dwr/engine.js, parse the response and bind the HTTP Session ID and scriptSessionId to JMeter variables:
And now to make an actual AJAX request:
To inspect your existing AJAX calls I recommend using a proxy such as Charles, Firebug doesn’t show you (or at least me:) the request parameters. Parameters to note are:
page:
where the click happened
batchId:
DWR seems fairly unbothered by this but I click through a sequence of events, setup my test plan to match that sequence and then use those batchIds (Charles’s sequence view is very useful for this)
c0-paramX:
Be sure to pass the required parameters.
Coming in Pt II … how to load test reverse AJAX connections. Watch this space.
2 Comments »
Leave a comment
-
Recent
- Kernel panics on Leopard
- Resizing off screen windows in OS X (Leopard)
- H264 quality differences in players
- ImageMagick on Leopard
- Automount on Leopard
- Monitoring HDD temperature
- Eclipse Europa and Leopard problems
- Macbook Pro wireless woes
- Budget reconciliation … UNIX style
- Load testing AJAX with JMeter
- MySQL undefined “user”
- SSH throughput
-
Links
-
Archives
- June 2008 (2)
- March 2008 (1)
- February 2008 (1)
- November 2007 (3)
- March 2007 (3)
- February 2007 (3)
- January 2007 (3)
- December 2006 (3)
- November 2006 (3)
-
Categories
-
RSS
Entries RSS
Comments RSS
Spanks alot!
This was really useful to me.
Comment by Arvid | January 16, 2009
Thanks for the guide. However the tricky thing is simulating of sending parallel AJAX requests. JMeter currently doesn’t provide a suitable test element so you’ll need to implement it by some sort of Java coding. See How to Load Test AJAX/XHR Enabled Sites With JMeter guide for implementation details.
Comment by glinius | August 1, 2014