Request Failed - request timeout

Hi!!!
I’m running load tests with k6, while running I’m getting the warning below:

WARN[0062] Request Failed   error="Post \"https://api.dev/v1/names\": request timeout"

Please, can anyone help me?
Is it a problem with the k6 tool?

Hi @PriKitice

From this single line, it doesn’t look like a k6 problem. What’s happening here, is that k6 tries to open a connection to the server your URL points to, and never gets an answer. After some timeout duration, the connection is dropped and the request is marked as a timeout.

This could be caused by many things, but usual suspects would be:

  • Is the URL correct?
  • does k6 run on a machine that has access (firewall or NAT routing) to the machine hosting api.dev?
  • does api.dev resolves (DNS) on the machine that’s running k6?
  • is api.dev down?

Let me know if that’s helpful. As a general rule, to be able to offer efficient support, we need questions to provide us as much context and disambiguation as possible. Thus, if there’s anything else which you think could be helpful to help solve this issue, don’t hesitate to include it :+1:

Hi @PriKitice if you send a request in setup function, you will set a timeout for that request,and besides you should set setupTimeout in the options. If this method don’t fix your issue you should talk with your network manager. Because there should be request time limit on your company side.

export function setup() {
  let res= http.post(
    Load.api + endpoints.Orders,
    JSON.stringify({
      sales: [
        {
          amountInOrder: 5,
          amount: 1000,
        },
      ],
      tenant: "test",
      
    }),
    {
      headers: 
        "Content-Type": "application/json",
      },
      timeout: "180s",
    }
  );
  return [
    res.json(),

  ];
}

const totalVu = 20;
export const options = {
  summaryTimeUnit: "ms",
  setupTimeout: "180s",
  scenarios: {
    test: {
      exec: "test",
      executor: "per-vu-iterations",
      vus: totalVu,
      iterations: 50,
    },
  },
};