Stress Testing
I was investigating a reported memory leak during the week so I needed to profile the server. The first technique I used was to profile the remote server, using
Enerjy Memory Profiler (which does not appear on their website anymore). A nice feature of Enerjy is that you can specify a method you wish to monitor, and get the profiler to automatically send a snapshot after each invocation of that method. This snapshot can contain information on objects created during the invocation of that method, and that have not yet been garbage collected. The problem I had with this was the server would crash after sending a snapshot.
So I decided to change my approach, I stopped sending snapshots automatically, and instead I decided to start from a very simple setup, and take a snapshot after a test run. I would then add in the other parts of the service one at a time, and rerun the test. I only configured the profiler to send heap snapshots to minimize the heavy lifting.
I had been told that
JMeter was the tool for the job so I decided to check it out. I needed to send SOAP conversations to the service, and each conversation was required to have a unique identifier.
The conversation consisted of a set and a get message:
I created a User Parameter to hold the ‘Identifier’ value. User parameters can be added to a Thread Group. This parameter must be unique for each invocation, so I needed a way to update it. JMeter has some built in
functions, one of which is
counter.
The counter generates a new number each time it is called, starting with 1 and incrementing by +1 each time. The counter can be configured to keep each simulated user’s values separate, or to use the same counter for all user. If each user’s values is incremented separately, that is like counting the number of iterations through the test plan. A global counter is like counting how many times that request was run.
I used this function to supply the value to my
ID parameter. I then added two SOAP/XML-RPC Request Samplers, one for the set and one for the get, with the following parameter referenced in the message:
After adding a Graph Results listener to each Sampler, I was ready to start testing. The combined use of the profiler and JMeter made my task much easier.