lwc:mqtt:loadtesting

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
lwc:mqtt:loadtesting [2021/10/05 07:47] – [Filimin Swarms] John Harrisonlwc:mqtt:loadtesting [2021/10/06 13:18] (current) – [Filimin Swarms] John Harrison
Line 21: Line 21:
 ===== Filimin Swarms ===== ===== Filimin Swarms =====
 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| 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|
-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 connection. So to work around this I also wrote a bash script that spawns multiple instances of the Python script (''filiminSwarms2.sh''). +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''). 
-  * ''filiminSwarms2.sh'' was able to create 60 swarms of 340 lamps each, grouped in 3s with each lamp in group touched every to seconds (''filiminSwarms2.sh 60 5 7 0'') on an 8GB 4CPU Linode VM. That's a total of 20,400 lamps. +  * ''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 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 
-  * The script broke at 100 swarms +  * 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. 
-  * Only 30 swarms ran successfully on 4GB 2CPU VM (broke at 40)+ 
 +===== 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 64000then ''sysctl -p /etc/sysctl.conf .'' 
 +  * effective range: ''sysctl net.ipv4.ip_local_port_range''  
  • lwc/mqtt/loadtesting.1633438047.txt.gz
  • Last modified: 2021/10/05 07:47
  • by John Harrison