Giter Site home page Giter Site logo

Suspected memory leak about jmeter HOT 3 OPEN

bilsch-nice avatar bilsch-nice commented on July 17, 2024
Suspected memory leak

from jmeter.

Comments (3)

FSchumacher avatar FSchumacher commented on July 17, 2024 1

You should not construct dynamic JSR 223 snippets within your tests, as those will end up in the metaspace.

What you did is, for every sample, you created a new text snippet. That snippet gets compiled into a groovy (class), which ends up in the metaspace.

The templating syntax ${...} should be avoided by all means in (groovy) JSR 223 scripts. Those parts get replaced while JMeter runs the test. As you are generating random text for each call of the sampler, you will get a unique script.
Another reason to not use templating inside groovy scripts, is that there is often a faster alternative. For your example, I believe the following snippet would be equivalent:

import org.apache.commons.lang3.RandomStringUtils;

String randomString = RandomStringUtils.randomAlphanumeric(16)
String hexString = randomString.getBytes("UTF-8").encodeHex();

vars.put("trace_id", hexString);

Another possibility would be to work with arguments and place the random bits with the templating syntax into the parameters section of the JSR 223 sampler (or pre-processor).

from jmeter.

KingRabbid avatar KingRabbid commented on July 17, 2024

Hi,

OOM aside, why do you need that complicated piece of code? You run a JSR223PreProcessor so you have full access to Groovy runtime, there's no need to call the ${__groovy()} function inside again.

I guess you need a unique value to use as trace identifier, this should be enough:
vars.put("trace_id", UUID.randomUUID().toString())
Sample output: ebd7bca8-c365-3b64-8157-11b165df0341

from jmeter.

bilsch-nice avatar bilsch-nice commented on July 17, 2024

Hi,

OOM aside, why do you need that complicated piece of code? You run a JSR223PreProcessor so you have full access to Groovy runtime, there's no need to call the ${__groovy()} function inside again.

I guess you need a unique value to use as trace identifier, this should be enough: vars.put("trace_id", UUID.randomUUID().toString()) Sample output: ebd7bca8-c365-3b64-8157-11b165df0341

The format of the trace_id needs to conform to the opentelemetry spec. Its a 32-byte hex string.

I actually switched over to gatling for this load test script. Generating the traceid in scala code directly and its proven stable so I've moved on from this.

Would be interested in someone else being able to re-create the scenario. If I understand the problem just adding the preprocessor with the code I included in this issue should be enough to replicate - don't even need to reference the variable I suspect.

from jmeter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.