Sunday 18 February 2024

How to Run different JAVA scripts using different JDK versions on the same LG

Running different Java scripts using different JDK versions on the same Load Generators in LoadRunner can be achieved by configuring the Java Runtime Environment (JRE) for each script individually. Here's a step-by-step guide:

1. Launch LoadRunner Agent as a Process: Start by launching the LoadRunner Agent on the Load Generator machine as a process. This can typically be done from the LoadRunner installation directory or through the command line.

Launch LoadRunner Agent as a Process:

  • Syntax: start <path_to_loadrunner_agent_executable>
  • Example: start C:\LoadRunner\bin\magentproc.exe

2. Enable Terminal Services: Before proceeding, ensure that Terminal Services are enabled on the Load Generator machine. This setting allows multiple users to log in and run processes concurrently.

Enable Terminal Services:

  • Syntax: Navigate to Start -> Programs -> LoadRunner -> Advanced Settings -> Agent Configuration -> Enable Terminal Services

3. Set Up Different Terminal Sessions: Open a separate terminal session for each JDK environment required by the scripts. Log in as a different user for each session to ensure isolation.

Example: set JAVA_HOME=C:\Program Files\Java\jdk1.8.0_291

4. Configure JDK Environment: In each terminal session, set up the environment variables to point to the respective JDK version required by the associated script. This ensures that each session uses the correct JDK.

5. Launch LoadRunner Agent: In each terminal session, launch the LoadRunner Agent process. The Agent will inherit the JDK environment specified in the session's environment variables.

Launch LoadRunner Agent:

  • Syntax: start <path_to_loadrunner_agent_executable>
  • Example: start C:\LoadRunner\bin\magentproc.exe
6. Connect Controller to Each Session: In the LoadRunner Controller, connect to each terminal session on the Load Generator machine using the appropriate connection method (e.g., RDP). Each session will be identified as LG:0, LG:1, LG:2, and so on.

7. Set Sessions to "Ready" State: Once connected, ensure that each session is in a "Ready" state in the Controller. This indicates that the LoadRunner Agent process is running and ready to execute scripts.

8. Run Scripts: Finally, run each script in the corresponding session that has the respective JDK environment configured. The scripts will execute using the JDK specified for each session, allowing concurrent execution of scripts requiring different JDK versions.

By following these steps, you can effectively manage and execute multiple scripts with different JDK requirements concurrently on a single Load Generator using Terminal Services. This approach provides flexibility and isolation for running scripts with diverse JDK dependencies.