Search code examples
macosperformance-testinggatlingweb-api-testinggatling-plugin

Getting j.n.SocketException: Connection reset by peer when I use 1000 open connection


I am using mac to test some apis using gatling. when I test 1000 around 450 of the connections are refused and anf this is really affecting my tests.Here is what I get

> j.n.SocketException: Connection reset by peer  

and here is my scenario

  def postNewQuery() = {
    exec(http("Post New Query")
          .post("/searches/")
            .body(ElFileBody("bodies/createQueryBody.json")).asJson
          .check(status.is(201)))
    }

   val scn = scenario("Post new games")
      .exec(postNewQuery())


  setUp(
    scn.inject(atOnceUsers(1000))
  ).protocols(httpConf)


}

What do you usually do in this case? do you increase any limit?


Solution

  • Connection reset by peer is exactly what happens: your network or your system under load doesn't like having to open that many sudden (atOnceUsers(1000)) connections at once and kills connections abruptly while requests are flying.

    Regarding your question about tuning, please read the documentation. However, this might not fix your issue if the bottleneck is not the local machine network stack but somewhere else.