Commit 595e1cc2c136f624ddf2309f5e0ee66e8290f5a9

Authored by Andrew Shvayka
1 parent d4b88f80

Performance improvements

@@ -29,9 +29,9 @@ app-dispatcher { @@ -29,9 +29,9 @@ app-dispatcher {
29 executor = "fork-join-executor" 29 executor = "fork-join-executor"
30 fork-join-executor { 30 fork-join-executor {
31 # Min number of threads to cap factor-based parallelism number to 31 # Min number of threads to cap factor-based parallelism number to
32 - parallelism-min = 2 32 + parallelism-min = 1
33 # Max number of threads to cap factor-based parallelism number to 33 # Max number of threads to cap factor-based parallelism number to
34 - parallelism-max = 12 34 + parallelism-max = 1
35 35
36 # The parallelism factor is used to determine thread pool size using the 36 # The parallelism factor is used to determine thread pool size using the
37 # following formula: ceil(available processors * factor). Resulting size 37 # following formula: ceil(available processors * factor). Resulting size
@@ -54,7 +54,7 @@ rpc-dispatcher { @@ -54,7 +54,7 @@ rpc-dispatcher {
54 # Min number of threads to cap factor-based parallelism number to 54 # Min number of threads to cap factor-based parallelism number to
55 parallelism-min = 2 55 parallelism-min = 2
56 # Max number of threads to cap factor-based parallelism number to 56 # Max number of threads to cap factor-based parallelism number to
57 - parallelism-max = 12 57 + parallelism-max = 8
58 58
59 # The parallelism factor is used to determine thread pool size using the 59 # The parallelism factor is used to determine thread pool size using the
60 # following formula: ceil(available processors * factor). Resulting size 60 # following formula: ceil(available processors * factor). Resulting size
@@ -82,7 +82,7 @@ core-dispatcher { @@ -82,7 +82,7 @@ core-dispatcher {
82 # The parallelism factor is used to determine thread pool size using the 82 # The parallelism factor is used to determine thread pool size using the
83 # following formula: ceil(available processors * factor). Resulting size 83 # following formula: ceil(available processors * factor). Resulting size
84 # is then bounded by the parallelism-min and parallelism-max values. 84 # is then bounded by the parallelism-min and parallelism-max values.
85 - parallelism-factor = 1.0 85 + parallelism-factor = 0.25
86 } 86 }
87 # How long time the dispatcher will wait for new actors until it shuts down 87 # How long time the dispatcher will wait for new actors until it shuts down
88 shutdown-timeout = 1s 88 shutdown-timeout = 1s
@@ -105,7 +105,7 @@ rule-dispatcher { @@ -105,7 +105,7 @@ rule-dispatcher {
105 # The parallelism factor is used to determine thread pool size using the 105 # The parallelism factor is used to determine thread pool size using the
106 # following formula: ceil(available processors * factor). Resulting size 106 # following formula: ceil(available processors * factor). Resulting size
107 # is then bounded by the parallelism-min and parallelism-max values. 107 # is then bounded by the parallelism-min and parallelism-max values.
108 - parallelism-factor = 1.0 108 + parallelism-factor = 0.25
109 } 109 }
110 # How long time the dispatcher will wait for new actors until it shuts down 110 # How long time the dispatcher will wait for new actors until it shuts down
111 shutdown-timeout = 1s 111 shutdown-timeout = 1s
@@ -128,7 +128,7 @@ plugin-dispatcher { @@ -128,7 +128,7 @@ plugin-dispatcher {
128 # The parallelism factor is used to determine thread pool size using the 128 # The parallelism factor is used to determine thread pool size using the
129 # following formula: ceil(available processors * factor). Resulting size 129 # following formula: ceil(available processors * factor). Resulting size
130 # is then bounded by the parallelism-min and parallelism-max values. 130 # is then bounded by the parallelism-min and parallelism-max values.
131 - parallelism-factor = 1.0 131 + parallelism-factor = 0.25
132 } 132 }
133 # How long time the dispatcher will wait for new actors until it shuts down 133 # How long time the dispatcher will wait for new actors until it shuts down
134 shutdown-timeout = 1s 134 shutdown-timeout = 1s
@@ -152,7 +152,7 @@ session-dispatcher { @@ -152,7 +152,7 @@ session-dispatcher {
152 # The parallelism factor is used to determine thread pool size using the 152 # The parallelism factor is used to determine thread pool size using the
153 # following formula: ceil(available processors * factor). Resulting size 153 # following formula: ceil(available processors * factor). Resulting size
154 # is then bounded by the parallelism-min and parallelism-max values. 154 # is then bounded by the parallelism-min and parallelism-max values.
155 - parallelism-factor = 1.0 155 + parallelism-factor = 0.25
156 } 156 }
157 # How long time the dispatcher will wait for new actors until it shuts down 157 # How long time the dispatcher will wait for new actors until it shuts down
158 shutdown-timeout = 1s 158 shutdown-timeout = 1s
@@ -167,7 +167,7 @@ actors: @@ -167,7 +167,7 @@ actors:
167 # Cache parameters 167 # Cache parameters
168 cache: 168 cache:
169 # Enable/disable cache functionality. 169 # Enable/disable cache functionality.
170 - enabled: "${CACHE_ENABLED:true}" 170 + enabled: "${CACHE_ENABLED:false}"
171 device_credentials: 171 device_credentials:
172 # Default time to store device credentials in cache, in seconds 172 # Default time to store device credentials in cache, in seconds
173 time_to_live: "${CACHE_DEVICE_CREDENTIAL_TTL:3600}" 173 time_to_live: "${CACHE_DEVICE_CREDENTIAL_TTL:3600}"
@@ -25,9 +25,9 @@ import java.util.concurrent.TimeUnit; @@ -25,9 +25,9 @@ import java.util.concurrent.TimeUnit;
25 @Slf4j 25 @Slf4j
26 public class TestParams { 26 public class TestParams {
27 static final String TEST_PROPERTIES = "test.properties"; 27 static final String TEST_PROPERTIES = "test.properties";
28 - static final long DEFAULT_TEST_DURATION = TimeUnit.MINUTES.toMillis(1); 28 + static final long DEFAULT_TEST_DURATION = TimeUnit.SECONDS.toMillis(1);
29 static final long DEFAULT_TEST_INTERVAL = TimeUnit.MILLISECONDS.toMillis(100); 29 static final long DEFAULT_TEST_INTERVAL = TimeUnit.MILLISECONDS.toMillis(100);
30 - static final int DEFAULT_DEVICE_COUNT = 25; 30 + static final int DEFAULT_DEVICE_COUNT = 2000;
31 static final String DEFAULT_REST_URL = "http://localhost:8080"; 31 static final String DEFAULT_REST_URL = "http://localhost:8080";
32 static final String DEFAULT_MQTT_URLS = "tcp://localhost:1883"; 32 static final String DEFAULT_MQTT_URLS = "tcp://localhost:1883";
33 static final String DEFAULT_USERNAME = "tenant@thingsboard.org"; 33 static final String DEFAULT_USERNAME = "tenant@thingsboard.org";
@@ -25,6 +25,7 @@ @@ -25,6 +25,7 @@
25 </encoder> 25 </encoder>
26 </appender> 26 </appender>
27 27
  28 + <logger name="io.gatling.core.action.Pause" level="WARN"/>
28 <logger name="org.thingsboard" level="INFO" /> 29 <logger name="org.thingsboard" level="INFO" />
29 30
30 <root level="INFO"> 31 <root level="INFO">
@@ -45,18 +45,18 @@ class MqttSimulation extends Simulation { @@ -45,18 +45,18 @@ class MqttSimulation extends Simulation {
45 val connect = exec(mqtt("connect") 45 val connect = exec(mqtt("connect")
46 .connect()) 46 .connect())
47 47
48 - val publish = repeat(400) { 48 + val publish = repeat(600) {
49 exec(mqtt("publish") 49 exec(mqtt("publish")
50 - .publish("v1/devices/me/telemetry", "{\"key1\":\"value1\", \"key2\":\"value2\"}", QoS.AT_LEAST_ONCE, retain = false)) 50 + .publish("v1/devices/me/telemetry", "{\"temperature\":\"42\"}", QoS.AT_LEAST_ONCE, retain = false)).pause(100 milliseconds)
51 } 51 }
52 52
53 val scn = scenario("Scenario Name") 53 val scn = scenario("Scenario Name")
54 - .feed(csv("/tmp/mqtt.csv").circular) 54 + .feed(csv("/tmp/mqtt.csv"))
55 .exec(connect, publish) 55 .exec(connect, publish)
56 56
57 setUp( 57 setUp(
58 scn 58 scn
59 - .inject(constantUsersPerSec(25) during (1 seconds)) 59 + .inject(constantUsersPerSec(1500) during (1 seconds))
60 ).protocols(mqttConf) 60 ).protocols(mqttConf)
61 61
62 } 62 }
@@ -76,7 +76,6 @@ public class MqttTransportService { @@ -76,7 +76,6 @@ public class MqttTransportService {
76 76
77 @PostConstruct 77 @PostConstruct
78 public void init() throws Exception { 78 public void init() throws Exception {
79 - ResourceLeakDetector.setLevel(ResourceLeakDetector.Level.ADVANCED);  
80 log.info("Starting MQTT transport..."); 79 log.info("Starting MQTT transport...");
81 log.info("Lookup MQTT transport adaptor {}", adaptorName); 80 log.info("Lookup MQTT transport adaptor {}", adaptorName);
82 this.adaptor = (MqttTransportAdaptor) appContext.getBean(adaptorName); 81 this.adaptor = (MqttTransportAdaptor) appContext.getBean(adaptorName);