0

I'm currently debugging a weird phenomenon. When running load tests I saw that I had some requests taking up to 9 seconds instead of a few milli seconds. Those requests are very sparse. They result in spikes and other problems which make the tests unusable. (I'm parsing the jmeter logs directly to elastic, thats why I have these graphics, Log data is correct I allready checked 10 Times)

Spikes

As you can see, other requests to the same endpoint in the same time from other threads are still very fast Requests

I then started to strip everything from the tests one by one and found the culprit. When I disable all the JSR223 Samplers I have there are no spikes. Weird thing is, that even when I add an empty JSR223 Sampler (No code inside) I have these "spikes"

So no spikes when I disable the empty sampler like this No Spikes

But spikes when I enable empty sampler (or some script in it doesn't matter) Spikes

I use latest justb4/docker-jmeter docker image version 5.4 This is my Jmeter file. Any ideas?

`

<?xml version="1.0" encoding="UTF-8"?>
<jmeterTestPlan version="1.2" properties="5.0" jmeter="5.4.3">
  <hashTree>
    <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="LoadScenarios.jmx" enabled="true">
      <stringProp name="TestPlan.comments">This test plan was created by the BlazeMeter converter v.2.4.18. Please contact support@blazemeter.com for further support.</stringProp>
      <boolProp name="TestPlan.functional_mode">false</boolProp>
      <boolProp name="TestPlan.serialize_threadgroups">true</boolProp>
      <elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" enabled="true">
        <collectionProp name="Arguments.arguments"/>
      </elementProp>
      <stringProp name="TestPlan.user_define_classpath"></stringProp>
    </TestPlan>
    <hashTree>
      <CookieManager guiclass="CookiePanel" testclass="CookieManager" testname="HTTP Cookie Manager" enabled="true">
        <collectionProp name="CookieManager.cookies"/>
        <boolProp name="CookieManager.clearEachIteration">false</boolProp>
        <boolProp name="CookieManager.controlledByThreadGroup">false</boolProp>
        <stringProp name="CookieManager.policy">compatibility</stringProp>
      </CookieManager>
      <hashTree/>
      <ConfigTestElement guiclass="HttpDefaultsGui" testclass="ConfigTestElement" testname="HTTP Request Defaults" enabled="true">
        <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true">
          <collectionProp name="Arguments.arguments"/>
        </elementProp>
        <stringProp name="HTTPSampler.domain">${ServiceURL}</stringProp>
        <stringProp name="HTTPSampler.port">${ServicePort}</stringProp>
        <stringProp name="HTTPSampler.protocol">${ServiceProtocol}</stringProp>
        <stringProp name="HTTPSampler.contentEncoding"></stringProp>
        <stringProp name="HTTPSampler.path"></stringProp>
        <boolProp name="HTTPSampler.image_parser">true</boolProp>
        <boolProp name="HTTPSampler.concurrentDwn">true</boolProp>
        <stringProp name="HTTPSampler.concurrentPool">6</stringProp>
        <stringProp name="HTTPSampler.implementation">HttpClient4</stringProp>
        <stringProp name="HTTPSampler.connect_timeout"></stringProp>
        <stringProp name="HTTPSampler.response_timeout"></stringProp>
      </ConfigTestElement>
      <hashTree/>
      <DNSCacheManager guiclass="DNSCachePanel" testclass="DNSCacheManager" testname="DNS Cache Manager" enabled="true">
        <collectionProp name="DNSCacheManager.servers"/>
        <boolProp name="DNSCacheManager.clearEachIteration">false</boolProp>
        <boolProp name="DNSCacheManager.isCustomResolver">false</boolProp>
      </DNSCacheManager>
      <hashTree/>
      <CacheManager guiclass="CacheManagerGui" testclass="CacheManager" testname="HTTP Cache Manager" enabled="true">
        <boolProp name="clearEachIteration">false</boolProp>
        <boolProp name="useExpires">false</boolProp>
        <boolProp name="CacheManager.controlledByThread">false</boolProp>
      </CacheManager>
      <hashTree/>
      <kg.apc.jmeter.threads.SteppingThreadGroup guiclass="kg.apc.jmeter.threads.SteppingThreadGroupGui" testclass="kg.apc.jmeter.threads.SteppingThreadGroup" testname="StressTestNetworkErrors" enabled="true">
        <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
        <stringProp name="ThreadGroup.num_threads">200</stringProp>
        <stringProp name="Threads initial delay">10</stringProp>
        <stringProp name="Start users count">10</stringProp>
        <stringProp name="Start users count burst">40</stringProp>
        <stringProp name="Start users period">120</stringProp>
        <stringProp name="Stop users count">5</stringProp>
        <stringProp name="Stop users period">1</stringProp>
        <stringProp name="flighttime">3600</stringProp>
        <stringProp name="rampUp">20</stringProp>
        <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
          <boolProp name="LoopController.continue_forever">false</boolProp>
          <intProp name="LoopController.loops">-1</intProp>
        </elementProp>
      </kg.apc.jmeter.threads.SteppingThreadGroup>
      <hashTree>
        <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="${__threadNum} Groovy Get After Login" enabled="true">
          <stringProp name="scriptLanguage">groovy</stringProp>
          <stringProp name="parameters"></stringProp>
          <stringProp name="filename"></stringProp>
          <stringProp name="cacheKey">false</stringProp>
          <stringProp name="script">def counter = 0
</stringProp>
        </JSR223Sampler>
        <hashTree/>
        <LoopController guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
          <boolProp name="LoopController.continue_forever">true</boolProp>
          <intProp name="LoopController.loops">-1</intProp>
        </LoopController>
        <hashTree>
          <ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="Constant Timer" enabled="true">
            <stringProp name="ConstantTimer.delay">300</stringProp>
          </ConstantTimer>
          <hashTree/>
          <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="StartCalcDuration" enabled="false">
            <stringProp name="scriptLanguage">groovy</stringProp>
            <stringProp name="parameters"></stringProp>
            <stringProp name="filename"></stringProp>
            <stringProp name="cacheKey">true</stringProp>
            <stringProp name="script"></stringProp>
          </JSR223Sampler>
          <hashTree/>
          <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="frontapi/Fuehrerwesen/Kunden/ConvertImageFromTiffToJpg" enabled="true">
            <boolProp name="HTTPSampler.postBodyRaw">true</boolProp>
            <elementProp name="HTTPsampler.Arguments" elementType="Arguments">
              <collectionProp name="Arguments.arguments">
                <elementProp name="" elementType="HTTPArgument">
                  <boolProp name="HTTPArgument.always_encode">false</boolProp>
                  <stringProp name="Argument.metadata">=</stringProp>
                </elementProp>
              </collectionProp>
            </elementProp>
            <stringProp name="HTTPSampler.domain"></stringProp>
            <stringProp name="HTTPSampler.port">9510</stringProp>
            <stringProp name="HTTPSampler.protocol">http</stringProp>
            <stringProp name="HTTPSampler.contentEncoding"></stringProp>
            <stringProp name="HTTPSampler.path">frontapi/Fuehrerwesen/Kunden/ConvertImageFromTiffToJpg?${__UUID}</stringProp>
            <stringProp name="HTTPSampler.method">POST</stringProp>
            <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
            <boolProp name="HTTPSampler.auto_redirects">false</boolProp>
            <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
            <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
            <boolProp name="HTTPSampler.image_parser">true</boolProp>
            <stringProp name="HTTPSampler.embedded_url_re"></stringProp>
            <stringProp name="HTTPSampler.implementation">HttpClient4</stringProp>
            <stringProp name="HTTPSampler.connect_timeout"></stringProp>
            <stringProp name="HTTPSampler.response_timeout"></stringProp>
          </HTTPSamplerProxy>
          <hashTree/>
        </hashTree>
      </hashTree>
    </hashTree>
  </hashTree>
</jmeterTestPlan>

`

somecoolname
  • 337
  • 5
  • 16

1 Answers1

0

It's utterly like to Garbage Collection in action, I would ensure that:

  1. You're using JVM which doesn't execute stop-the-world, it could lead to smoother results
  2. There is not enough JVM Heap so GC occurs more frequently or vice versa, the heap is too large and GC takes too long
  3. Your Groovy scripts are written in the way that they cannot be cached or jsr223.compiled_scripts_cache_size property default value of 100 is not sufficient for keeping all your scripts

So make sure to follow all recommendations from 9 Easy Solutions for a JMeter Load Test “Out of Memory” Failure article, as currently you're violating one of main JMeter Best Practices: not using the latest version of JMeter.

Dmitri T
  • 159,985
  • 5
  • 83
  • 133