Réalisation et Expertise technique IT

Load Testing Java Serialization performance

on 17 mai 2017 CI, DEVOPS, JAVA-SERIALIZATION, JMETER, PERFORMANCE and Étiquettes : , , , , , , with 0 comments

Load Testing Java Serialization performance

Load testing Java Serialization performance is not an easy matter as requests and responses are binary.

In order to make your load test realistic and useful, you always have to variabilize the requests and extract data from responses. Hopefully, thanks to our solution, you will be able to use the famous Open Source reference for Load Testing Apache JMeter combined with our Java Serialization plugin.

We’re happy to announce the release of the new version 3.3.0 of our UbikLoadPack Java Serialization plugin for Apache JMeter with the following features

Easy installation since 3.3.0

With this version, installing plugin is now very easy:

  • Download Java 8 last update and install it
  • Download and unzip Apache JMeter last version (3.2 at time of writing), we’ll call the target folder JMETER_HOME
  • Unzip the UbikLoadPack bundle (download instructions in trial mail) and copy file « lib/ext/ubik-jmeter-javaser-plugin.jar » to JMETER_HOME/lib/ext
  • Edit JMETER_HOME/bin/user.properties and add:
    • ULPJAVASERPLUGIN.LICENSEPATH=<PATH TO FOLDER CONTAINING LICENSE KEY>/ubik-javaser-plugin.license
    • where ubik-javaser-plugin.license is the file attached to the trial mail
  • Copy your application jars into a folder we’ll call APPLICATION_JARS and add to user.properties:
    • plugin_dependency_paths=<Path to APPLICATION_JARS>
  • Start JMeter
  • Check in JMETER_HOME/bin/jmeter.log that you don’t have any misconfiguration issue

Easy application recording

Plugin will record the queries and automatically transform the binary protocol to a readable XML format that you’ll be able to variabilize, asserts, correlate.

In order to do that:

  • Configure your application as per instructions in PDF docs and start it
  • In JMeter, select File > Templates… and select Recording then click Create:

Recording Java Serialization Application with JMeter

  • Start recording by clicking on Start button in « HTTP(S) Test Script Recorder » element

JAVASER start recording

  • Now use your application as per your scenario and you will see ULP_JAVA Serialization Sampler with an XML Body automatically being created under Thread Group > Recording Controller. Ensure you make a pause of 5 seconds between every step so that all requests are grouped under one Transaction Controller. In the example below, we have made numStore, login and accessToken variables that can come from a CSV or from a previous request like for accessToken.

ULP_JAVA Serialization Sampler

Easy and powerful correlation

Once you have recorded, you now need to do correlation which implies:

  • Extracting data from a request N
  • Injecting it (using it) in request N+i

Without our plugin, the responses being binary, this would be impossible.

To extract data from Binary responses, our plugin offers 2 Extractors:

  • ULP RESPONSE AS XML PostProcessor :

This processor extracts the object and transforms it to XML for manipulation by JMeter XPath Extractor. In the example below, this post processor will transform binary response to XML and store it under variable « RESPONSE« . You can then extract any data from it using regular JMeter XPath Assertion and selecting « JMeter variable » and setting it to RESPONSE

ULP JAVA to XML

  • ULP_Response AS JAVA OBJECT PostProcessor :

This processor extracts part of the response object or the full response object and makes it available as a JMeter variable for manipulation by JSR223 Test elements and Groovy. In the example below, this post processor will transform the binary response to a Java Object, then call getValue() and store the result under « userData » variable.

ULP Java as Object

This Post Processor is applied to the following response (transformed to XML by the plugin thanks to ULP_Java-to-XML renderer in View Results Tree):

ULP_Transform-To-Xml

Once done, you can then easily modify this object with a JSR223 Post Processor and some Groovy code:

JSR223 updateObject with Groovy

You are then able to serialize it again to XML using the next function that will translate it to binary format. You would pass userData to it.

Function __ulpJavaToXml

This plugin offers a function __ulpJavaToXml that allows you to serialize the Java Object again to XML.

Here, you can see thanks to Function Helper Dialog, its parameters:

ulp_javaser_function_helper_dialog

And how we can use it in a Java Serialization Sampler (that plugin will automagically transform to binary format) to serialize back to XML the Java Object stored under variable « transactionBO« :

Function ulpJavaToXml

Checking your responses are ok

As with any load test, it is critical to ensure that the response you receive is valid. Failing to do that leads to wrong load test.

To solve this issue easily, the plugin offers a Java Assertion which is very similar to JMeter Response Assertion.

In the below example, this assertion will call on root Object the getter getValue().getCustomerId() and check that the result contains ${customerNumber}.

ULP Java ASSERTION

Support of Apache JMeter 3.2

Finally, the new version of the plugin now supports Apache JMeter 3.2 which has been released in april 2017 with a bunch of new features that make scripting and load testing even more productive and nice.

You can see some of the new features and bug fixes reading this blog.

NDLR

As we have seen in this blog, our plugin offers a complete solution for writing realistic load tests for most complex applications and integrates smoothly with JMeter within View Results Tree, functions, samplers, post-processors and assertions.

If you’re familiar with JMeter, you’ll very rapidly understand how it works without any training as it follows JMeter’s philosophy.

If you’re not familiar with JMeter, then you should start learning it as it is a very powerful tool that allows you to load test a lot of protocols natively and without any license fee. If you still have a doubt, then read this.

Once your script is developed you can load test either from your own machines or from the Cloud and generate a nice report or have live results persisted in an Influx DB for live graphs.

So try it ASAP by asking for a 10 days free trial here.

About author:

Philippe Mouawad works as an Architect and technical expert for Ubik-Ingenierie where he leads among other things the development of UbikLoadPack a set of Commercial Plugins for Apache JMeter allowing to load test different protocols like MPEG-DASH, Http Live Streaming, GWT, JavaSerialization.
Philippe is a committer on the Apache JMeter project and member of the PMC since October 2011.
Finally he is a co-author of a french book on JMeter called Maîriser JMeter: Du test de charge à Devops.

About us: