记录一次 post 请求的并发测试

curl ‘http://127.0.0.1:48652/api/luckids/admin/group/add_schedule’ -H ‘authority: t-luckids-service.luckids.club’ -H ‘accept: application/json, text/plain, /’ -H ‘origin: https://t-luckids-service.luckids.club’ -H ‘x-token: 89CE71AFD98ADF32BBD749CFCC920B3C9BB21E8BC73569E90BCDB042AE3B83F558FEA0F6918A5F762F43FF23FADB20A8BE72E09FEA2BE8E60BFD0D43564FE2F95E55084B9343846748D0E296AD158A2A’ -H ‘platform: 1’ -H ‘user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36’ -H ‘content-type: application/json;charset=UTF-8’ -H ‘sec-fetch-site: same-origin’ -H ‘sec-fetch-mode: cors’ -H ‘referer: http://127.0.0.1:48652/’ -H ‘accept-encoding: gzip, deflate, br’ -H ‘accept-language: zh-CN,zh;q=0.9,en;q=0.8’ -H ‘cookie: token=89CE71AFD98ADF32BBD749CFCC920B3C9BB21E8BC73569E90BCDB042AE3B83F558FEA0F6918A5F762F43FF23FADB20A8BE72E09FEA2BE8E60BFD0D43564FE2F95E55084B9343846748D0E296AD158A2A’ --data-binary ‘{“groupId”:“G16FAC4F072492B360FA”,“learnTime”:“2020-03-26 12:00:00”}’ --compressed

jmeter 测试并发

<?xml version="1.0" encoding="UTF-8"?>
<jmeterTestPlan version="1.2" properties="5.0" jmeter="5.2.1">
  <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">false</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>
          <stringProp name="LoopController.loops">10</stringProp>
        </elementProp>
        <stringProp name="ThreadGroup.num_threads">1</stringProp>
        <stringProp name="ThreadGroup.ramp_time">0</stringProp>
        <boolProp name="ThreadGroup.scheduler">false</boolProp>
        <stringProp name="ThreadGroup.duration"></stringProp>
        <stringProp name="ThreadGroup.delay"></stringProp>
        <boolProp name="ThreadGroup.same_user_on_next_iteration">true</boolProp>
      </ThreadGroup>
      <hashTree>
        <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="HTTP Request" 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.value">{&quot;groupId&quot;:&quot;G16FAC4F072492B360FA&quot;,&quot;learnTime&quot;:&quot;2020-03-26 19:30:00&quot;}</stringProp>
                <stringProp name="Argument.metadata">=</stringProp>
              </elementProp>
            </collectionProp>
          </elementProp>
          <stringProp name="HTTPSampler.domain">127.0.0.1</stringProp>
          <stringProp name="HTTPSampler.port">48652</stringProp>
          <stringProp name="HTTPSampler.protocol">http</stringProp>
          <stringProp name="HTTPSampler.contentEncoding"></stringProp>
          <stringProp name="HTTPSampler.path">/api/luckids/admin/group/add_schedule</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>
          <stringProp name="HTTPSampler.embedded_url_re"></stringProp>
          <stringProp name="HTTPSampler.connect_timeout"></stringProp>
          <stringProp name="HTTPSampler.response_timeout"></stringProp>
        </HTTPSamplerProxy>
        <hashTree/>
        <ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="View Results Tree" enabled="true">
          <boolProp name="ResultCollector.error_logging">false</boolProp>
          <objProp>
            <name>saveConfig</name>
            <value class="SampleSaveConfiguration">
              <time>true</time>
              <latency>true</latency>
              <timestamp>true</timestamp>
              <success>true</success>
              <label>true</label>
              <code>true</code>
              <message>true</message>
              <threadName>true</threadName>
              <dataType>true</dataType>
              <encoding>false</encoding>
              <assertions>true</assertions>
              <subresults>true</subresults>
              <responseData>false</responseData>
              <samplerData>false</samplerData>
              <xml>false</xml>
              <fieldNames>true</fieldNames>
              <responseHeaders>false</responseHeaders>
              <requestHeaders>false</requestHeaders>
              <responseDataOnError>false</responseDataOnError>
              <saveAssertionResultsFailureMessage>true</saveAssertionResultsFailureMessage>
              <assertionsResultsToSave>0</assertionsResultsToSave>
              <bytes>true</bytes>
              <sentBytes>true</sentBytes>
              <url>true</url>
              <threadCounts>true</threadCounts>
              <idleTime>true</idleTime>
              <connectTime>true</connectTime>
            </value>
          </objProp>
          <stringProp name="filename"></stringProp>
        </ResultCollector>
        <hashTree/>
        <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP Header Manager" enabled="true">
          <collectionProp name="HeaderManager.headers">
            <elementProp name="" elementType="Header">
              <stringProp name="Header.name">x-token</stringProp>
              <stringProp name="Header.value">89CE71AFD98ADF32BBD749CFCC920B3C9BB21E8BC73569E90BCDB042AE3B83F558FEA0F6918A5F762F43FF23FADB20A8BE72E09FEA2BE8E60BFD0D43564FE2F95E55084B9343846748D0E296AD158A2A</stringProp>
            </elementProp>
            <elementProp name="" elementType="Header">
              <stringProp name="Header.name">content-type</stringProp>
              <stringProp name="Header.value">application/json;charset=utf-8</stringProp>
            </elementProp>
          </collectionProp>
        </HeaderManager>
        <hashTree/>
      </hashTree>
    </hashTree>
  </hashTree>
</jmeterTestPlan>

Apache Benchmark 并发

ab -n 10 -c 10 -T “application/json” -p file -H ‘x-token: 89CE71AFD98ADF32BBD749CFCC920B3C9BB21E8BC73569E90BCDB042AE3B83F558FEA0F6918A5F762F43FF23FADB20A8BE72E09FEA2BE8E60BFD0D43564FE2F95E55084B9343846748D0E296AD158A2A’ http://127.0.0.1:48652/api/luckids/admin/group/add_schedule

file 文件内容:

{"groupId":"G16FAC4F072492B360FA","learnTime":"2020-03-26 19:30:00"}
发布了123 篇原创文章 · 获赞 6 · 访问量 1万+
展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 技术工厂 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览