SAP Business Intelligence load testing with Apache JMeter

on 7 April 2015 JMETER with 0 comments

Context

SAP Business Intelligence load testing

You need to deploy a SAP BI application and need to ensure you have built a performing infrastructure and it will face correctly the incoming traffic.

To do so, you need to pick up one of the multiple Load Testing tools (Commercial or Open Source) to simulate the user’s work and see how your platform reacts.

Hopefully one of the best tools for this is Apache JMeter which second good news is free.

You may want to read this blog on why JMeter is a very good choice in general but in this particular context of SAP BI, the are additional reasons why Apache JMeter is one of your best options.

Overview

Load testing a SAP Business Intelligence (also called SAP Business Object or Webi) application with JMeter raises a number of challenges and will lead you to make use of advanced JMeter features.

It is definitly not the “Hello world” sample to start playing with JMeter but the good news is that there it is no difference in the way you will record and script.

SAP BI – Javascript complexity

The real difference compared to “other types  of applications” is the scripting complexity level. Scripting a SAP BI application tends to be much more difficult because of its massive use of Javascript.

As in every JMeter script, each request needs its parameters to be “variabilized” with data retrieved from previous responses. To do so, such a task usually requires :

  1. Parameter type determination : whether sent data is JSON, XML, timestamp, token, sequence, number, simple value, composite value, etc.
  2. Data location: Search and locate in previous responses the pieces of data you need to reintroduce in subsequent requests
  3. Data extraction: Extract required data from a response and store it in a JMeter variable for later use, such as reintroducing it in a subsequent request for example

Once data has been located and extracted, data reintroduction is trivial as long as the extracted value is of the exact same type (and structure) as the reintroduced parameter value. However, when complex data type such as JSON (or XML, etc.) is to be reintroduced after it has been updated and its structure has been modified then things start turning in a much more intricate way. Unfortunatly this is exactly what happens when scripting a SAP BI application.

Given the following excerpt, one can understand what is really at stake. This screenshot demonstrates the differences between of a JSON sample that is retrieved from the server (on the left) and what should actually be sent in a subsequent request (on the right) : the gap gives an idea of what is going to be undertaken to find out what should be done to move from the left Json (server provided) to the right Json (that you have to send back).

1-webidemo_1-response-prompts.json-webidemo_2-request-prompts1

 SAP BI – How to script with JMeter

It starts to be obvious that the logic to be applied to the left version of the JSON so as to get to the right one cannot be “guessed” as it used to be the case in simple JMeter scripting.
The logic and restructuration applied to the retrieved JSON -before its reintroduction- requires you to inspect the actual code that performs that logic, and that logic is Javascript embedded in the retrieved web pages.

Locating SAP BUSINESS INTELLIGENCE logic

SAP BI logic has to be pinpointed within the retrieved Javascript code (inlined in web pages and/or linked in *.js files) in order to find out how data is being updated. Once logic has been located -and understood-, it has to be implemented in the JMeter script so that data can be updated in the same way that a browser would do it.

To do so, you will have to leverage your favorite browser debugging capabilities such as Firebug for example, if your are a Firefox enthusiast. Setting breakpoints on appropriate events or at relevant locations in Javascript code in order to discover the SAP BI business logic to be implemented in your JMeter script.

2-webidemo_firebug-1024x302

Implement SAP BUSINESS INTELLIGENCE logic in your JMeter script

This is the moment where JMeter JSR223 come into play: JMeter JSR223 scripting capabilities combined with the Groovy API makes it possible to implement -in your JMeter script- the Javascript SAP BI logic previously located and extracted from the Javascript code.

According to your JMeter script layout, this can be done using JSR223 PreProcessor, JSR223 Sampler or JSR223 PostProcessor. Using Groovy language with compilation cache key to take advantage of pre-compilation performance makes it possible to leverage the full Groovy API tool set in order to handle XML, JSON and much much more data structures.

3-webidemo_jmeter_tree

4-webidemo_jmeter_jsr223_groovy

Results

Once scripting is done, you can start load testing your infrastructure and get nice graphs that will help you size your platform correctly.

With this done we were able to help our customers:

  • find contention points in the custom development
  • fix some misconfiguration and tune other parts of the infrastructure
  • increase their machine CPUs to have correct response times

When all this was done, application could GO LIVE without happy clients and no outage.

Conclusion

Scripting a SAP BI application with Apache JMeter is not different from scripting a “standard” application. Scenario recording does not change and the overall procedure remains the same. However, it requires a good background in JMeter capabilities, especially with JSR223 scripting features, Groovy being the most appropriate scripting language in its case. Data extraction skills will as well be expected as multiple types and formats have to be handled, ranging from HTML form values to JSON and XML fragments, not to mention the unavoidable regular expressions.

Application code inspection should also be expected and Javascript debugging not be overlooked as well because it is most often the only way to find out how data should properly be formed. You will then have to take maximum advantage of your browser debugging features in order to locate data in the wood of the SAP BI code.

Putting it alltogether, Apache JMeter makes it possible to load run a SAP BI application. The path to success is your browser debugging tools and your JMeter scripting skills.

About us: