Monday, November 11, 2013

Syntax comparison between JMeter and Netgend

Jmeter is a great open source performance testing platform.  It's used by a large community of users and gain popularity at the cost of loadrunner, as shown in this report thanks to the job site Indeed.

    The Jmeter GUI is nice. But to gain performance advantage, one may have to run it on command line as suggested by this tip.  Also, you may have to be careful on how many threads to have, because  hundreds of active threads may affect performance. This creates a problem:  when HTTP transaction latency is high, say, hundreds of milliseconds, one needs to have a large number of VUsers (threads) to bring up the transaction rate, but a large number of threads may affect performance.

    These are not the toughest problems with JMeter,  the toughest problem is with parameterization or correlation:  user needs to be really good at Java programming to do it.   For many users with only basic programming background, this can be a serious challenge.

    Netgend javascript makes things simpler:
  • Don't have to worry about the number of threads,  one system can support about 50,000 VUsers.
  • Complex parameterization/correlation can be simple. 
  • Can view real time statistics on GUI while many VUsers are running.

    The following question asked on a forum provides an excellent example.   The question is on processing the following "complex" JSON message and extract the values of two fields "equipmentPartId",  "compositePartName".

       "compositePartName":"SRW224G4P-K9-AU ",  
    "status":"validation ok",  
    "messages":", Non Configurable"  
       "compositePartName":" UC560-T1E1-K9 ",  
    "messages":", Non Configurable"  
    Here is a solution given for JMeter.
 import org.json.JSONArray;  
 import org.json.JSONObject;  
 String jsonString = prev.getResponseDataAsString();  
 JSONArray equipmentParts = new JSONArray(jsonString);  
 print("parsed json");  
 JSONArray parts = new JSONArray();  
 for(int i=0;i<equipmentParts.length();i++ ){  
      JSONObject equipmentPart = equipmentParts.getJSONObject(i).getJSONObject("equipmentPart");  
      JSONObject allAttributes = equipmentPart.getJSONObject("allAttributes");  
      JSONObject part = new JSONObject();  
      // add more here  
 vars.put("jsonResponse", parts.toString());  
    An ordinary user have to really focus his/her attention to be able to follow it.  With Netgend javascript, it's as simple as the following:

 a = fromJson(data); 
 parts = [];
 for (i = 0; i < getSize(a); i++) {
      part.partId   = a[i].equipmentPart.allAttributes.equipmentPartId;
      part.partName = a[i].equipmentPart.allAttributes.compositePartName;
      push(parts, part); 
    Here the compound variable "a[i].equipmentPart.allAttributes.equipmentPartId" is based on the JSON message structure: at highest level, this JSON message is an array,  the each element in the array can be represented by a[i],  in each element, we have hierarchy like equipmentPart -- allAttributes --equipmentPartId.  Now you understand where the compound variable comes from.

   We believe parameterization/correlation should be made so simple that one doesn't need to be a guru on programming to do performance testing!   

No comments:

Post a Comment