How do I increase number of websocket clients in Nodejs Socket.io server deployed on AWS ECS fargate?
Asked Answered
F

1

6

I am running socket server container in AWS Fargate using socket.io

Everything works fine with connected users around 800-1000, But when the number of clients increases old socket connection gets disconnected automatically with error transport error.

My AWS ECS service(Fargate container) running behind AWS application load balancer.

Any specific configuration need to apply to support thousands of concurrent connection to my container?

Is there any limit of the number of concurrent users can connect to a single socket server?

AWS task definition has 4GB memory and 2 CPU

Socket server code:

io = module.exports = require('socket.io')(server, {
  'pingInterval': 10000,
  'pingTimeout': 7000,
  'origins': (env.APPLY_ALLOW_ORIGIN_FILTER) ? env.SOCKET_WHITELIST_URL : '*:*',
  transports: ['websocket', 'htmlfile', 'xhr-polling', 'jsonp-polling', 'polling']
})
Franglais answered 21/8, 2018 at 10:9 Comment(0)
L
0

One thing you can try is increase the nofile ulimit: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definition_parameters.html#container_definition_limits.

This controls the maximum number of open files, including network sockets.

Lactase answered 16/9, 2022 at 7:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.