Both sides previous revision Previous revision Next revision | Previous revision |
lwc:mqtt:loadtesting [2021/10/05 07:38] – John Harrison | lwc:mqtt:loadtesting [2021/10/06 13:18] (current) – [Filimin Swarms] John Harrison |
---|
</code> | </code> |
===== Filimin Swarms ===== | ===== Filimin Swarms ===== |
I wrote ''filiminSwarm2.py'' which emulates groups of lamps. Because of [[https://github.com/eclipse/paho.mqtt.python/issues/238|a limitation in python and/or the mqtt implementation of python]] the script can only connect 340 lamps in a single Python instance. To work around this I also wrote a bash script that spawns multiple instances of the Python script (''filiminSwarms2.sh''). | I wrote ''filiminSwarm2.py'' which emulates groups of lamps. Because of a limitation in python and/or the mqtt implementation of python ([[https://github.com/eclipse/paho.mqtt.python/issues/183|183]], [[https://github.com/eclipse/paho.mqtt.python/issues/238| |
* ''filiminSwarms2.sh'' was able to create 60 swarms of 340 lamps each, grouped in 3s with each lamp in group touched every 5 to 7 seconds (''filiminSwarms2.sh 60 3 5 7 0'') on an 8GB 4CPU Linode VM. That's a total of 20,400 lamps. | 238]], [[https://github.com/eclipse/paho.mqtt.python/issues/499|499]]) the script can only connect 340 lamps in a single Python instance. In theory a recompile of Python2 should fix this but I tried and with the ''FD_SETSIZE'' changed from 1024 to 65536 I got buffer overflow errors in Python after 340 connections. So to work around this I also wrote a Bash script that spawns multiple instances of the Python script (''filiminSwarms2.sh''). |
* The script broke at 100 swarms | * ''filiminSwarms2.sh'' was able to create 58 swarms of 340 lamps each, grouped in 3s with each lamp in group touched every 120 to 150 seconds (''filiminSwarms2.sh 58 3 120 150 0'') on an 8GB 4CPU Linode VM. That's a total of 19,720 lamps. At 67 swarms the ephemeral port range appears to become an issue |
* Best guess is the 60 swarms would also run on 4GB 2CPU VM | * The current Linode haproxy load balancer (haproxyMaster) is 8GB/4 dedicated CPUs. It successfully handled the load of 11 load testers (11 * 19720 = 216920 lamps). There were 12 mosquitto nodes connected to it at less than 10% CPU. Sync service was around 50-60% CPU. |
| |
| ===== Ephemeral port range ===== |
| The default ''ip_local_port_range'' severely limits the number of connections between 2 machines. |
| * current range: ''sysctl -A | grep ip_local_port_range'' |
| * to extend without rebooting edit ''/etc/sysctl.conf'' (good values are 15000 64000) then ''sysctl -p /etc/sysctl.conf .'' |
| * effective range: ''sysctl net.ipv4.ip_local_port_range'' |