Maximum simultaneous connections on a mosquitto broker

nano /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
nano /etc/security/limits.conf
*       soft    nofile  262144
*       hard    nofile  262144
*       soft    nproc  262144
*       hard    nproc  262144
cat /proc/sys/net/ipv4/ip_local_port_range
cat /proc/sys/kernel/threads-max
nano .bashrc
ulimit -t unlimited
ulimit -c unlimited
ulimit -a

References
https://lists.launchpad.net/mosquitto-users/msg00163.html