thingsboard-aplcache

Performance improvements

1/5/2017 9:19:10 AM

Details

diff --git a/application/src/main/resources/actor-system.conf b/application/src/main/resources/actor-system.conf
index 7bd80ab..cceaf96 100644
--- a/application/src/main/resources/actor-system.conf
+++ b/application/src/main/resources/actor-system.conf
@@ -29,9 +29,9 @@ app-dispatcher {
   executor = "fork-join-executor"
   fork-join-executor {
       # Min number of threads to cap factor-based parallelism number to
-      parallelism-min = 2
+      parallelism-min = 1
       # Max number of threads to cap factor-based parallelism number to
-      parallelism-max = 12
+      parallelism-max = 1
       
       # The parallelism factor is used to determine thread pool size using the
       # following formula: ceil(available processors * factor). Resulting size
@@ -54,7 +54,7 @@ rpc-dispatcher {
       # Min number of threads to cap factor-based parallelism number to
       parallelism-min = 2
       # Max number of threads to cap factor-based parallelism number to
-      parallelism-max = 12
+      parallelism-max = 8
 
       # The parallelism factor is used to determine thread pool size using the
       # following formula: ceil(available processors * factor). Resulting size
@@ -82,7 +82,7 @@ core-dispatcher {
       # The parallelism factor is used to determine thread pool size using the
       # following formula: ceil(available processors * factor). Resulting size
       # is then bounded by the parallelism-min and parallelism-max values.
-      parallelism-factor = 1.0
+      parallelism-factor = 0.25
   }
   # How long time the dispatcher will wait for new actors until it shuts down
   shutdown-timeout = 1s
@@ -105,7 +105,7 @@ rule-dispatcher {
       # The parallelism factor is used to determine thread pool size using the
       # following formula: ceil(available processors * factor). Resulting size
       # is then bounded by the parallelism-min and parallelism-max values.
-      parallelism-factor = 1.0
+      parallelism-factor = 0.25
   }
   # How long time the dispatcher will wait for new actors until it shuts down
   shutdown-timeout = 1s
@@ -128,7 +128,7 @@ plugin-dispatcher {
       # The parallelism factor is used to determine thread pool size using the
       # following formula: ceil(available processors * factor). Resulting size
       # is then bounded by the parallelism-min and parallelism-max values.
-      parallelism-factor = 1.0
+      parallelism-factor = 0.25
   }
   # How long time the dispatcher will wait for new actors until it shuts down
   shutdown-timeout = 1s
@@ -152,7 +152,7 @@ session-dispatcher {
       # The parallelism factor is used to determine thread pool size using the
       # following formula: ceil(available processors * factor). Resulting size
       # is then bounded by the parallelism-min and parallelism-max values.
-      parallelism-factor = 1.0
+      parallelism-factor = 0.25
   }
   # How long time the dispatcher will wait for new actors until it shuts down
   shutdown-timeout = 1s
diff --git a/application/src/main/resources/thingsboard.yml b/application/src/main/resources/thingsboard.yml
index 2b42bdd..9eb3205 100644
--- a/application/src/main/resources/thingsboard.yml
+++ b/application/src/main/resources/thingsboard.yml
@@ -167,7 +167,7 @@ actors:
 # Cache parameters
 cache:
   # Enable/disable cache functionality.
-  enabled: "${CACHE_ENABLED:true}"
+  enabled: "${CACHE_ENABLED:false}"
   device_credentials:
     # Default time to store device credentials in cache, in seconds
     time_to_live: "${CACHE_DEVICE_CREDENTIAL_TTL:3600}"
diff --git a/tools/src/main/java/org/thingsboard/client/tools/TestParams.java b/tools/src/main/java/org/thingsboard/client/tools/TestParams.java
index 1286f5e..f6ffb46 100644
--- a/tools/src/main/java/org/thingsboard/client/tools/TestParams.java
+++ b/tools/src/main/java/org/thingsboard/client/tools/TestParams.java
@@ -25,9 +25,9 @@ import java.util.concurrent.TimeUnit;
 @Slf4j
 public class TestParams {
     static final String TEST_PROPERTIES = "test.properties";
-    static final long DEFAULT_TEST_DURATION = TimeUnit.MINUTES.toMillis(1);
+    static final long DEFAULT_TEST_DURATION = TimeUnit.SECONDS.toMillis(1);
     static final long DEFAULT_TEST_INTERVAL = TimeUnit.MILLISECONDS.toMillis(100);
-    static final int DEFAULT_DEVICE_COUNT = 25;
+    static final int DEFAULT_DEVICE_COUNT = 2000;
     static final String DEFAULT_REST_URL = "http://localhost:8080";
     static final String DEFAULT_MQTT_URLS = "tcp://localhost:1883";
     static final String DEFAULT_USERNAME = "tenant@thingsboard.org";
diff --git a/tools/src/main/resources/logback.xml b/tools/src/main/resources/logback.xml
index 11973fa..d3d16ab 100644
--- a/tools/src/main/resources/logback.xml
+++ b/tools/src/main/resources/logback.xml
@@ -25,6 +25,7 @@
         </encoder>
     </appender>
 
+    <logger name="io.gatling.core.action.Pause" level="WARN"/>
     <logger name="org.thingsboard" level="INFO" />
 
     <root level="INFO">
diff --git a/tools/src/test/scala/org/thingsboard/client/tools/MqttSimulation.scala b/tools/src/test/scala/org/thingsboard/client/tools/MqttSimulation.scala
index 6002ede..80732f5 100644
--- a/tools/src/test/scala/org/thingsboard/client/tools/MqttSimulation.scala
+++ b/tools/src/test/scala/org/thingsboard/client/tools/MqttSimulation.scala
@@ -45,18 +45,18 @@ class MqttSimulation extends Simulation {
   val connect = exec(mqtt("connect")
       .connect())
 
-  val publish = repeat(400) {
+  val publish = repeat(600) {
     exec(mqtt("publish")
-      .publish("v1/devices/me/telemetry", "{\"key1\":\"value1\", \"key2\":\"value2\"}", QoS.AT_LEAST_ONCE, retain = false))
+      .publish("v1/devices/me/telemetry", "{\"temperature\":\"42\"}", QoS.AT_LEAST_ONCE, retain = false)).pause(100 milliseconds)
   }
 
   val scn = scenario("Scenario Name")
-    .feed(csv("/tmp/mqtt.csv").circular)
+    .feed(csv("/tmp/mqtt.csv"))
     .exec(connect, publish)
 
   setUp(
       scn
-        .inject(constantUsersPerSec(25) during (1 seconds))
+        .inject(constantUsersPerSec(1500) during (1 seconds))
   ).protocols(mqttConf)
 
 }
\ No newline at end of file
diff --git a/transport/mqtt/src/main/java/org/thingsboard/server/transport/mqtt/MqttTransportService.java b/transport/mqtt/src/main/java/org/thingsboard/server/transport/mqtt/MqttTransportService.java
index e8569cf..02f6b40 100644
--- a/transport/mqtt/src/main/java/org/thingsboard/server/transport/mqtt/MqttTransportService.java
+++ b/transport/mqtt/src/main/java/org/thingsboard/server/transport/mqtt/MqttTransportService.java
@@ -76,7 +76,6 @@ public class MqttTransportService {
 
     @PostConstruct
     public void init() throws Exception {
-        ResourceLeakDetector.setLevel(ResourceLeakDetector.Level.ADVANCED);
         log.info("Starting MQTT transport...");
         log.info("Lookup MQTT transport adaptor {}", adaptorName);
         this.adaptor = (MqttTransportAdaptor) appContext.getBean(adaptorName);