Kafka tests

This topic describes how to use Kafka scripts in LoadRunner Enterprise performance tests.

Kafka tests overview

Apache Kafka is an event-streaming platform that provides unified, high-throughput, low-latency data feeds. It is often used to pass messages between microservices and software components. Refer to the product documentation for more details.

You can manually create your script in VuGen using the Kafka protocol, then add it to a performance test in LoadRunner Enterprise, and view run results in the Kafka graphs in LoadRunner Enterprise and Analysis. The Kafka protocol supports scripting in Java, using standard Java conventions.

Kafka scripts can be run on a load generator on a Windows or Linux operating system. The Docker installations of Windows and Linux also support Kafka scripts.

Back to top

Prerequisite setup for Kafka tests

Note the following guidelines before creating a performance test with a Kafka script:

Installation requirements

Download and install a 32-bit or 64-bit JDK (version 8 or 11) on all load generator machines on which the script is run. For supported versions of Kafka, see the Supported Protocols guide (available from Support Matrix).

Load generator setup

  • Java setting for Windows: Check that the environment variable %PATH% includes the directory of jvm.dll (for example: %JAVA_HOME%/jdk/jre/bin/server).

  • Java setting for Linux: Check that the environment variable $LD_LIBRARY_PATH includes the directory of libjvm.so.

  • We recommend setting the JAVA_HOME environment variable to point to the Java JDK folder.

LoadRunner Agent settings

  • If the agent is set as Service, change the System environment variables JAVA_HOME and PATH, and restart the load generator machine.

  • If the agent is set as Process, change any User or System environment variables JAVA_HOME and PATH, and restart the agent.

Creating Kafka scripts
  • Create a Kafka script in VuGen. For details, see Kafka protocol in the Virtual User Generator Help Center.

  • The scripts must be saved in ZIP format and must include all the files in the test scripts folder.

  • The file path inside a script folder must not exceed 260 characters.

Back to top

Add Kafka scripts to performance tests

This task describes how to add Kafka scripts to performance tests.

  1. Make sure that you follow the prerequisites for using Kafka scripts.

    For details, see Prerequisite setup for Kafka tests.

  2. Upload Kafka scripts to LoadRunner Enterprise

    You can upload the script in any of the following ways:

    After uploading the script to LoadRunner Enterprise, the script is added to the test management tree. You can view and edit most scripts directly from within the LoadRunner Enterprise user interface. For details, see Edit a script.

  3. (Optional) Edit the script parameters

    After you have uploaded a Kafka script to LoadRunner Enterprise, you can edit the script parameters. For details, see Edit script parameters.

  4. Create a LoadRunner Enterprise test, and assign the Kafka script to it.

    For details, see Design a test.

  5. (Optional) Configure runtime settings

    Before you run a performance test, you can view and configure the behavior of the Vuser scripts in the test using runtime settings. For details, see Configure runtime settings.

  6. Run the test.

    For details, see Manage a performance test run.

    Data points from Kafka tests are displayed in the LoadRunner Enterprise graphs. For details, see View Kafka test results.

Back to top

View Kafka test results

Measurements can be viewed online and offline in LoadRunner Enterprise and Analysis, using the data points from the Kafka tests.

The following monitors are available for performance tests running Kafka scripts:

Monitor Description

Kafka Producer Duration

Displays the response time, in milliseconds, between a record sent and a confirmation received, each time the Kafka producer sends a record to the broker.

Kafka Throughput

Displays the amount of data, in bytes, that the producer published to (Publish throughput), or the consumer received from (Receipt throughput), the broker at any time during the performance test run.

Kafka Message Rate

Displays the number of messages published (Publish rate) and received (Receive rate) per second, at any time during the performance test run.

Back to top

See also: