You can imagine where it goes from here…

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:

jmeter login

jmeter get httpsession id

setup script session id

And now to make an actual AJAX request:

make ajax call

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:


where the click happened


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)


Be sure to pass the required parameters.

Coming in Pt II … how to load test reverse AJAX connections. Watch this space.


March 13, 2007 - Posted by | Tech


  1. Spanks alot!

    This was really useful to me.

    Comment by Arvid | January 16, 2009

  2. 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

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: