How many concurrent WebSocket connections are possible in gatling? For me it is failing to make event 50 concurrent connections. Please help.

Hi I am using Gatling 3.1.1 and want to simulate 1000 concurrent WebSocket connections. But it failing at 50. In the below code, I tried to simulate 100 concurrent users, all are connecting to WebSocket in parallel. But only a few of them are able to make WebSocket connection and rest are failing. Below is my code snippet

val EmployeeCredentialsFeeder = csv(“data/Test Employees.csv”).batch(30) // Employees Credential feeder(csv)

val scn = scenario(“TXP_Login”)

.feed(EmployeeCredentialsFeeder) // feed clientID, username and password for Login from csv file
.exec(checkLogin()) //Execute checkLogin method

//create feeder for SessionID and Employee ID. poll() method will retrieve the head item from the queue and delete it
// Here Session ID’s and Employee ID’s are polled from queue and map to Session_ID and Employee_ID variable

val SessionIDFeeder = Iterator.continually(Map(“Session_ID” → Session_ID_Queue.poll()))
val EmployeeIDFeeder = Iterator.continually(Map(“Employee_ID” → Employee_ID_Queue.poll()))

// Get and Update self Scehdule

val scn1 = scenario(“Get_Assign_SelfSCH_Websocket”)

//Make the variables as session variables to have them avaiable in next scenario
.set(“endDate”, endDate))
.exec(.set(“Company_ID”, Company_ID))
.set(“Branch_ID”, Branch_ID))

//Feed the SessionID, EmployeeID, and clientID through the feeder


// Make Websocket Connection


exec(ws(“Connection Check”)


.exec(getSelfSchedule()) // run getSelfSchedule method

.exec(updateSelfSchedule()) // run updateSelfSchedule method


setUp(scn.inject(rampUsers(50) during(15)), scn1.inject(nothingFor(18 seconds), atOnceUsers(50)).protocols(httpProtocol))


Only 23 out of 50 were able to make successful connections and 27 failed. I need to simulate this scenario for 1000’s of users. Any idea how to make these many concurrent connections? Below is the error that I am getting. Please help

Don’t blame the messenger.
502 Bad Gateway means an intermediary proxy or load balancer received an incorrect answer from the actual application.

Thanks Stephane for prompt reply. But could you please suggest how to overcome this issue. Is it possible to optimize my code? Because if I simulate 20 users then it works fine. We implemented websocket on AWS. So it scales pretty well and can work with tens of thousands of concurrent users.

As Stephane said, check max WebSocket connections allowed in AWS from the same host. It’s probably that they are preventing a DDoS attack by limiting the number of connections.

El dissabte, 4 maig de 2019 7:49:23 UTC+2, bhawna garg va escriure: