Search code examples
javatestingjarperformance-testingload-testing

how to Load test a java api (Jar) using modern tools?


I have a simple java code integrated with Apache Camel which also uses camel-kafka component for logging messages in kafka topics. I have created a class which handles single request. Using threads I can create various threads to invoke above class method to log messages.

Currently I need to load test this JAR using a tool. I want to know a tool that have very low learning curve.

Load test:

  • increasing users to allow multiple messages to be logged concurrently
  • variation of messages to increase/decrease message size
  • Time taken by specific users to log specific messages.

I have gone through

  • JMeter (learning curve is big)
  • JProfiler (it does not load test but monitors the application if I am not wrong)
  • Netbeans Load generator (again it uses JMeter)

Solution

    1. Download groovy-all-*.jar and drop it to /lib folder of your JMeter installation
    2. Restart JMeter
    3. Add Thread Group to test plan. Set desired amount of virtual users, interations and/or duration.
    4. Add JSR223 Sampler as a child of the thread group
    5. Choose "groovy" in the "language" dropdown
    6. Put your "simple java code" in JSR223 Sampler's "Script" area
    7. Save test plan.
    8. Run it.

    Was that so hard?