← Back to team overview

mosquitto-users team mailing list archive

Re: maximum of simultaneous connections on a mosquitto broker

 

Hi Chris,

On the same thread, I testified to achieve 100K concurrent connections on one mosquitto broker, installed on one medim sized EC2 instance.
All the clients were simultaneously connected, as both $SYS/broker/clients/active and netstat show that number.
Rate of message sending was something like 2-3 per second.
Note: the connections were not secured (no SSL)  I tested SSL and saw that it significantly reduces both the capacity for concurrent connections and performance of message sending.
mosquitto version that was tested was 1.0.5.

here are the details of the test machine
OS: Ubuntu 12.04 x64.

/etc/sysctl.conf
fs.file-max = 999999
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.ipv4.tcp_rmem = 4096 4096 16777216
net.ipv4.tcp_wmem = 4096 4096 16777216
net.ipv4.tcp_syncookies = 1
# this gives the kernel more memory for tcp
# which you need with many (100k+) open socket connections
net.ipv4.tcp_mem = 50576   64768   98152
net.core.netdev_max_backlog = 2500

/etc/security/limits.conf
*       soft    nofile  262144
*       hard    nofile  262144
*       soft    nproc  262144
*       hard    nproc  262144

/proc/sys/net/ipv4/ip_local_port_range
32768   61000
/proc/sys/kernel/threads-max
26488

.bashrc
ulimit -t unlimited
ulimit -c unlimited

ulimit -a
core file size          (blocks, -c) unlimited
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 13244
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 13244
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

hope this helps.

Sharon

From: mosquitto-users-bounces+sharon.ben-asher=avg.com@xxxxxxxxxxxxxxxxxxx [mailto:mosquitto-users-bounces+sharon.ben-asher=avg.com@xxxxxxxxxxxxxxxxxxx] On Behalf Of Chris Herssens
Sent: Friday, January 18, 2013 2:22 PM
To: mosquitto-users@xxxxxxxxxxxxxxxxxxx
Subject: [Mosquitto-users] maximum of simultaneous connections on a mosquitto broker

Hello all,

In the thread https://lists.launchpad.net/mosquitto-users/msg00107.html is it mentioned that is should be poosilbe to connect 200k devices on the broker.
I find this very high since the broker is single threaded and use the poll() api which is of order O(n).
Is it possible to tell me how you did this test ?  How do you have to configure the EC2 instance so that we can handle  200K connections?
Are all the clients simultaneous  connected to the broker  and what is the rate of the messages ?  How many subscriptions to you have?

Regards,
Chris

References