Sign up in 30 seconds.
No credit card.
No risk.
No download.
Load Testing AJAX in LoadStorm
- Tags:
Load testing tools can apply large volumes of virtual users against a web application. In its simplest form, LoadStorm generates traffic that goes to a site, searches the home page HTML for links, randomly chooses one and activates that link. The tool carries out a series of these HTTP requests for as many simulated users as the tester requests.
That simple load testing scenario produces results with KPIs such as error rates and response times that the tester can analyze. However when AJAX enters the equation, load testing gets a bit trickier.
First, a couple of quick definitions. Javascript is the browser script language, and AJAX is a technology typically utilizing Javascript. The purpose of AJAX is to enable "richer" applications than traditional html. It does this by using asynchronous coding in the browser for visual effects and background calls to the server which might be triggered by the user or might happen periodically.
The background server calls can then refresh the data on the page without a full page refresh. The acronym is Asynchronous Javascript And Xml, but that has really been dropped over the past few years because it does not necessarily use Javascript or XML. Javascript is still by far the most common language, but Flash and Silverlight are contenders with their languages. XML is still common as a response, but there are other typical responses that are also frequently used including fragments of HTML, JSON, YAML, CSV and other text formats. In some cases binary responses are also used, although this is rare except with images.
Some AJAX tutorials and helpful articles:
- Webucator Tutorial
- Realtime Form Validation Using Ajax
- w3schools Tutorial
- Ajax Tutorial
- Jabet Tutorial
The basic premise of how our load testing tool works is that we emulate what the browser does in terms of sending requests to the server and checking how the server responds. What gets complicated is emulating what the browser does with the user. Some examples would be mouseover events, form input assistance, and dashboard graph refreshes. HTTP/HTTPS is a very simple protocol, but the addition of AJAX creates dimensions of complexity to the processing because of the increased interaction with the server.
Most modern web apps are really just an advancement of client/server technology. Instead of having a Windows or Java app as the client, we are using the browser as sort of an interpreter and presentation layer display for a client app. You can think of the HTML pages and their Javascript as the actual client side of the application.
What happens inside the client application when we use AJAX is that the Javascript sends an HTTP request to the server and then does something with the response. At this stage, we aren't really trying to run the client application, we are just trying to emulate what it sends as HTTP traffic to the server. So, we are able to do a lot of what AJAX does in terms of submitting HTTP requests.
For a concrete example, our charts rely on AJAX technology. When you request a page with a chart, the HTML page loads (HTTP request #1). In the page there is some Javascript that loads a Flash object from our server (HTTP request #2). The Flash object makes an XML request to our server for the chart data (HTTP request #3) and renders the chart. For a running load test, the XML is refreshed every 10 seconds (HTTP request #4+). We emulate each of these requests, and although they aren't coordinated with the exact time intervals, under load they look to the server like just a bunch of requests. So, if you get the approximate proportions of requests right, you have made a valid load test.
The LoadStorm load generator will actually run Javascript. We have this turned off right now because we want to reduce the number of moving parts at this stage. We are probably a month away from turning it on because it will require a good bit of user feedback in building scenarios and such that will take some time. We anticipate some problems with this, since it is basically providing a programming language to users and it will behave differently from what the browsers do in some cases. However, we have come a long way in technology standardization, thus there are many fewer issues with differences among browsers than the old days of LearnCentrix v1.0. We released that web app in 2000.
AJAX Greek hero
Comments
Hi Scott I am a newbie to
Hi Scott
I am a newbie to Loadstorm. I am trying to run load tests on a AJAX heavy web site. When I run the test, I see no activity on our SQL Server, only the requests are coming to IIS. Looks like loadstorms submitting agent does not support javascript or something like that. The message I saw is
Page excerpt:This site requires a browser that supports JavaScript. Your browser either does not support JavaScript, or it has JavaScript support disabled. If you want to correctly view this page, please upgrade y ...
Can you please let me know what should I do to test my website?
Thanks
Chandra
Hi Chandra, I have spend a
Hi Chandra,
I have spend a bit of time looking over your server and the search form behavior that you are trying to test. The short answer is that we do support javascript, but there is no support for debugging yet so it is very difficult to figure out exactly what is happening here.
I think that you are seeing the "This site requires a browser that supports JavaScript ..." message simply because this is the first block of text parsed on the page. We are downloading and trying to process the javascript that comes later, but since your form does not actually get submitted like a traditional web page form, the search does not actually happen as it does for a user with a browser. So, the result is the same as if you just requested the search page again.
One solution that would have close to the desired effect is to determine what url would actually return the JSON that is being requested in the background. This will only work if it is requested with a GET method and query string parameters. A POST would require the underlying form to be available and return HTML. In LoadStorm, you could then accomplish this with an "open" step.
The open step would then request the data like the AJAX call that retrieves the search results:
-- actual URL removed --
I'm not sure how the parameters would work.
Sorry that it does not work quite like you need it to. We are continually trying to improve the functionality and currently working on form processing and AJAX. Let me know if you have other questions,
Roger Campbell
Hi Roger, Are there any
Hi Roger,
Are there any improvements about Ajax processing?
Hi Roger, Is there anything
Hi Roger,
Is there anything new in the AJAX processing?