moscajs / aedes

Barebone MQTT broker that can run on any stream server, the node way
MIT License
1.75k stars 228 forks source link

[bug] Number of TCP Connections accepted on container is less than the one deployed in EC2 machine #949

Closed zagadheesh closed 1 month ago

zagadheesh commented 2 months ago

System Information

Describe the bug We deployed aedes in AWS ECS where the conatiner is running in M5.2xlarge machine. Broker has been configured with TCP 1883 port. CPU and memory have been allocated so that the container can use more than 80% resources of machine. With the java simulator client we tried to open subscribers where each subscriber connects to different topic. But, in this case broker giving continous disconnections after accepting upto 10,000 connections. AEDES deployed in M5.2xlarge machine directly instead of container is accepting upto 1.5 Lakhs connections. In both cases we are trying to open connections in the chunks of 5000. On Every increment of 5k the CPU is spiking upto 99% and coming back to normal. Mongo has been used as a persistence and emitter.No errors are observed in both cases. We are unable to identify why the container is accepting very less number of connections compared to the one that is directly running in EC2.

To Reproduce Steps to reproduce the behavior:

  1. Deploy AEDES as a continer (dockerfile attched)
  2. Run a simulator that simulates number of subscribers where each subscriber connects to different topic
  3. Deploy AEDES in EC2
  4. Run a simulator that simulates number of subscribers where each subscriber connects to different topic

Expected behavior As explained, in bothe cases the number of connections accepted by broker should be same.

aedes_dockerfile.txt

aedes.zip

Gianluca-Casagrande-Stiga commented 2 months ago

Hi, I would like to have more information: how many container and broker instances did you deploy? Is MongoDB into another container or in a separate environment? Anyway, I think it's not an Aedes bug, but an AWS ECS limit on concurrent connections.

zagadheesh commented 2 months ago

Hi @Gianluca-Casagrande-Stiga , Thanks for your reply. Its only one instance of broker(child processess = number of cores) in either case. Mongo is in separate environment.

mcollina commented 2 months ago

Usually container environments are not tuned to let a massive number of connections to the vms. Some tuning is required.

zagadheesh commented 2 months ago

@mcollina is the tuning required in aedes configuration or container environment?

robertsLando commented 2 months ago

@zagadheesh container

mcollina commented 2 months ago

the container hosts generically

zagadheesh commented 1 month ago

@robertsLando @mcollina Thanks for confirming.