Apache JMeter for ArcGIS Server: simple tutorial

Recently I got a chance to play with Apache JMeter. There is a great blog post from Esri about the JMeter, what it is and what one can do with that.

Please go ahead and read the post to get to know JMeter. I am personally interested in JMeter as a tool that allows me to test the ArcGIS Server 10.1 software by simulating having multiple users performing various requests to the services or server itself. Let’s consider a following scenario:
You have installed ArcGIS Server 10.1 in the staging environment and want to know how the software will handle hundreds of requests coming to your map service. Do you need more hardware? Do you need to specify a bigger maximum number of instances for the map service? That type of questions is something ArcGIS Server administrator deal often and I believe JMeter is a good starting point for those who want to see how well the software operates.

One way to test the ArcGIS Server is to ask a hundred of people get at their computers, open a web browser and come to the web application where the map service is being drawn. Thereafter, you could collect the statistics on the map service and server performance from the ArcGIS Server logs and/or operating system monitoring facilities. However, it is so much easier to get this kind of work done in an automated fashion.

It might be not that easy to learn how JMeter components organized GUI-wise (those who figured out how to use Windows 8 tiles will probably need less time though), so we will start by creating a really simple test project. In this sample project, we will run several identical requests to the sample ArcGIS Server SampleWorldCities map service shipped out-of-the-box in order to get the image of the map back. When we will be done with that, we will gradually make things a bit more complex and there you would probably see the true power of JMeter. This however will happen in the upcoming posts.

The information in the Esri Support Services post is good enough to let you get JMeter up and running. Now there are just some steps left:

  1. Right-click the Test Plan in the tree panel to the left and choose Add > Threads (Users) > Thread group. This is to group users that will perform requests to the map service. Apache1
  2. Rename the Thread Group to the “Map service image export”.
  3. Right-click the Map service image export thread group in the tree panel to the left and choose Add > Sampler > HTTP Request. This will represent the actual request that user will send to the map service.Apache2
  4. Rename the HTTP Request to “Export a map image with bounding box” and set all other properties as on the picture.
    Server name or IP: your machine name (can keep it as localhost for now).
    Port number: 6080 (though you definitely could use the path with web adaptor going via port 80 or some other port your IIS web application is configured to run at).
    Implementation: here we are telling to use HttpClient4 (go and ask some Java guru why the client is called HttpClient4).
    Parameters: f=image is something that is dictated by REST API syntax (to get the image back and not just text)
    Path: /arcgis/rest/services/SampleWorldCities/MapServer/export?bbox=-104.53020709870626,-25.471925275660684,75.35704494206294,51.908146633940035. This is the path you can get by browsing to the SampleWorldCities map service in the Services Directory application (click to browse). By using this URL, we are asking the SampleWorldCities map service to generate a map image for us based on the specified bounding box, or extent.Apache3
  5. If you click the Map service image export thread group we’ve created in the beginning, you can set the properties of the requesting process. Here we set properties for our threads (think users) that will be running. By default, we have just one user (Number of Threads (users) = 1) that will ask the map service to generate and ship the image in the specified extent back to the client from server just once (Loop Count = 1). Ramp-up Period is just a period of time that should past before the number of active users (threads) will reach the number you specify. From the Apache help: “The ramp-up period tells JMeter how long to take to “ramp-up” to the full number of threads chosen. If 10 threads are used, and the ramp-up period is 100 seconds, then JMeter will take 100 seconds to get all 10 threads up and running.”Apache5
  6. Right-click the Export a map image with bounding box sample request we’ve just created and choose Add > Listener > View Results Tree. This is to let us see how the request is being performed, what time it takes to run the request and actually make sure we have got our image back.Apache4
  7. Click the View Results Tree in the left panel and then choose Run > Start from the main menu (or press Ctrl-R). This will perform the export image operation. If you click the Export a map image with bounding box and switch to the Response data tab, you should see the map image received.Apache6

Congratulations! You have just performed a very simple yet automated test to get to know JMeter and how it can be used for performance & testing purposes when using ArcGIS Server. You can now play around a bit more with:

  • The listeners – by adding a couple of other listeners to check how else you might see the results as well as how much time it took (right-click the Export a map image with bounding box in the tree in the left panel and choose Add > Listener > View Results in Table or Add > Listener > Response Time Graph).
  • The threads – go to the Map service image export thread group and increase the number of threads (i.e., users) and set to run the test forever. Remember that you can stop sending requesting by using the Run > Stop in the main menu.

Sometime later I will let you know what other good things (but a bit more complex to implement) one can take advantage of when using JMeter for ArcGIS Server. Happy testing!

Advertisements

3 thoughts on “Apache JMeter for ArcGIS Server: simple tutorial

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s