我目前正在调试一个奇怪的现象。当运行负载测试时,我发现我有一些请求花费了9秒而不是几毫秒。这些请求非常稀疏。它们导致尖峰和其他问题,使测试无法使用。(我直接解析jmeter日志为弹性,这就是为什么我有这些图形,日志数据是正确的,我已经检查了10次)
正如您所看到的,其他线程在同一时间对同一端点的其他请求仍然非常快
然后,我开始一个一个地剥离测试中的所有内容,并找到了罪魁祸首。当我禁用所有JSR 223采样器时,没有出现尖峰。奇怪的是,即使我添加了一个空的JSR 223采样器(内部没有代码),也会出现这些“尖峰”。
因此,当我禁用空采样器(如
)时,不会出现尖峰
但当我启用空采样器时会出现尖峰(或一些脚本在无所谓)
我使用最新的justb 4/docker-jmeter docker image版本5.4这是我的Jmeter文件。有什么想法吗?
`
<?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>
`
1条答案
按热度按时间1tuwyuhd1#
这就完全像Garbage Collection在行动,我会保证:
1.您正在使用不执行stop-the-world的JVM,这可能会导致更平滑的结果
1.没有足够的JVM Heap,因此GC发生得更频繁,反之亦然,堆太大,GC花费的时间太长
1.您的Groovy脚本的编写方式无法缓存,或者
jsr223.compiled_scripts_cache_size
属性的默认值100不足以保留所有脚本因此,请确保遵循9 Easy Solutions for a JMeter Load Test “Out of Memory” Failure文章中的所有建议,因为目前您违反了JMeter Best Practices的一个主要规则:而不是使用最新版本的JMeter。