JMeter:热以避免TCP采样器请求之间的间隔

nfzehxib  于 2023-05-17  发布在  其他
关注(0)|答案(1)|浏览(162)

有一个时间间隔(约2秒)之间的TCP请求“登录巴姆”和“热拍”后,“登录巴姆”发送,任何人都可以告诉我如何避免这个时间间隔,将是真正的赞赏。
我勾选了“不延迟”框,但没有用。
以下是JMeter计划脚本(.jmx):

<?xml version="1.0" encoding="UTF-8"?>
<jmeterTestPlan version="1.2" properties="5.0" jmeter="5.5">
  <hashTree>
    <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan" enabled="true">
      <stringProp name="TestPlan.comments"></stringProp>
      <boolProp name="TestPlan.functional_mode">false</boolProp>
      <boolProp name="TestPlan.tearDown_on_shutdown">true</boolProp>
      <boolProp name="TestPlan.serialize_threadgroups">true</boolProp>
      <elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
        <collectionProp name="Arguments.arguments"/>
      </elementProp>
      <stringProp name="TestPlan.user_define_classpath"></stringProp>
    </TestPlan>
    <hashTree>
      <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Thread Group" enabled="true">
        <stringProp name="ThreadGroup.on_sample_error">continue</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>
        <stringProp name="ThreadGroup.num_threads">1</stringProp>
        <stringProp name="ThreadGroup.ramp_time">1</stringProp>
        <boolProp name="ThreadGroup.scheduler">false</boolProp>
        <stringProp name="ThreadGroup.duration">0</stringProp>
        <stringProp name="ThreadGroup.delay"></stringProp>
        <boolProp name="ThreadGroup.same_user_on_next_iteration">true</boolProp>
      </ThreadGroup>
      <hashTree>
        <TCPSampler guiclass="TCPSamplerGui" testclass="TCPSampler" testname="login-bam" enabled="true">
          <stringProp name="TCPSampler.classname">BinaryTCPClientImpl</stringProp>
          <stringProp name="TCPSampler.server">10.3.0.132</stringProp>
          <boolProp name="TCPSampler.reUseConnection">true</boolProp>
          <stringProp name="TCPSampler.port">60101</stringProp>
          <boolProp name="TCPSampler.nodelay">true</boolProp>
          <stringProp name="TCPSampler.timeout">2000</stringProp>
          <stringProp name="TCPSampler.ctimeout">2000</stringProp>
          <stringProp name="TCPSampler.request">630000000100003133366132396537316335373435653538313366666465666138633264633739023401002220807b227479706522203a202242414d222c22696422203a202231222c2276657222203a2022312e302e30222c22687274223a2234227d</stringProp>
          <boolProp name="TCPSampler.closeConnection">false</boolProp>
          <stringProp name="TCPSampler.soLinger">0</stringProp>
          <stringProp name="ConfigTestElement.username"></stringProp>
          <stringProp name="ConfigTestElement.password"></stringProp>
        </TCPSampler>
        <hashTree/>
        <TCPSampler guiclass="TCPSamplerGui" testclass="TCPSampler" testname="heatbeat" enabled="true">
          <stringProp name="TCPSampler.classname">BinaryTCPClientImpl</stringProp>
          <stringProp name="TCPSampler.server">10.3.0.132</stringProp>
          <boolProp name="TCPSampler.reUseConnection">true</boolProp>
          <stringProp name="TCPSampler.port">60101</stringProp>
          <boolProp name="TCPSampler.nodelay">true</boolProp>
          <stringProp name="TCPSampler.timeout">10000</stringProp>
          <stringProp name="TCPSampler.ctimeout">10000</stringProp>
          <stringProp name="TCPSampler.request">2f0000000100006332373265613362646163373435626239343039333030313537313362393165023300002220477d</stringProp>
          <boolProp name="TCPSampler.closeConnection">false</boolProp>
          <stringProp name="TCPSampler.soLinger">0</stringProp>
          <stringProp name="ConfigTestElement.username"></stringProp>
          <stringProp name="ConfigTestElement.password"></stringProp>
        </TCPSampler>
        <hashTree/>
      </hashTree>
    </hashTree>
  </hashTree>
</jmeterTestPlan>
kgsdhlau

kgsdhlau1#

JMeter在发送下一个请求之前等待上一个请求的响应。因此,heartbeat将仅在login-bam请求完成后执行。
如果您希望同时执行它们,则有以下选项:
1.将它们放在不同的线程组下
1.把它们放在Parallel Controller下,它同时并行运行它的子节点。
1.将线程数增加到2并添加同步定时器,这样两个请求将在同一时刻执行,当最长的一个完成执行时,两个请求将再次被启动,等等。

相关问题