【问题标题】:Running k6 script with multiple vusers fails with "request canceled (Client.Timeout exceeded while awaiting headers)" error使用多个 vuser 运行 k6 脚本失败,并出现“请求已取消(等待标头时超出 Client.Timeout)”错误
【发布时间】:2017-07-29 06:02:10
【问题描述】:

我的以下 k6 脚本在 1 个 vuser 下运行良好。但是每当我使用超过 1 个 vuser 运行时,脚本都会失败:-

(←[33mWARN←[0m[0114] 请求失败 ←[33merror←[0m="Post http://myurl.mycompany.com/v1/Order: net/http: 请求已取消(Client.Timeout 在等待标头时超出)")。

请参阅下面的脚本。任何帮助将不胜感激。

// Auto-generated by the Load Impact converter

import http from "k6/http";
import { check, group, sleep} from "k6";

export let options = {
  vus: 2,
  duration: "120s",
//  maxRedirects: 4
}

export default function() {
    let res;
    res = http.post("http://myurl.mycompany.com.com/v1/Order",
      "{    \"orderNumber\": \"\",  \"webConfirmationId\": 12345,   \"opptunityNum\": \"201707-861215\",    \"accountNumber\": \"GNUF4240\",    \"CustomerInstructions\": \"\", \"internalComments\": [     {           \"text\": \"Client Contact: John D johnd@mycompany.com 2125555555 \"        }   ],  \"OrderContact\": \"\", \"SalesForceContactId\": \"\",  \"ancillaryItems\": [       {           \"ancillaryItemTypeCode\": \"DISCOUNT\",            \"description\": \"2% Web Discount\",           \"unitPrice\": -4.99,           \"quantity\": 1.0       }   ],  \"billToAddress\": {},  \"CampaignNumber\": \"ZXYCR\",  \"ChargeLogicReferenceNumber\": \"\",   \"createDate\": \"2017-07-26T20:19:54.587Z\",   \"CON\": \"\",  \"orderTypeCode\": \"4XD\"  }",
      { headers: { "Authorization" : "bearer jahhHodoUVVTKqhsypd_tWbcsk", "Content-Type" : "application/json" } });
    check(res, {
      "is status 200":(r)=>r.status===200
    });
    sleep(3);
}

【问题讨论】:

  • 你确定不是你这边的东西,即服务器端,导致了这个吗?从我所见,您似乎想要测试一个电子商务应用程序,而您的 k6 脚本在该站点上看起来就像一个用户/帐户同时发送同一订单的多个相同版本。我敢打赌,很可能会给另一方面的电子商务引擎造成一些混乱。或者它可能是一些缓存系统混淆并阻止同一事务的副本通过,也许。
  • 你是对的。这是来自数据库服务器(表锁),尽管错误消息没有表明这一点。感谢您指出这一点。

标签: performance-testing load-testing k6


【解决方案1】:

响应代码应该是 201,因为它是一个创建操作,因为它是一个 POST 请求。

【讨论】:

    猜你喜欢
    • 2019-12-25
    • 2019-04-03
    • 2016-11-28
    • 2020-09-23
    • 2022-07-28
    • 2021-07-03
    • 2019-09-20
    • 2021-02-18
    • 1970-01-01
    相关资源
    最近更新 更多