thingsboard / thingsboard

Open-source IoT Platform - Device management, data collection, processing and visualization.
https://thingsboard.io
Apache License 2.0
17.25k stars 5.08k forks source link

MQTT Netty #3142

Open fjpa121197 opened 4 years ago

fjpa121197 commented 4 years ago

Hi, I have a question regarding the mqtt netty parameters in TB. How should the "boss_group_thread_count" and " worker_group_thread_count" parameters be changed? Under what values and based on what should those changed?

TB server is hosted in: Proceessor: Intel Core i5-3570 CPU @3.40GHz x 4 RAM: 8GB Disk Size 500GB

mqtt:
    # Enable/disable mqtt transport protocol.
    enabled: "${MQTT_ENABLED:true}"
    bind_address: "${MQTT_BIND_ADDRESS:0.0.0.0}"
    bind_port: "${MQTT_BIND_PORT:1883}"
    timeout: "${MQTT_TIMEOUT:10000}"
    netty:
      leak_detector_level: "${NETTY_LEAK_DETECTOR_LVL:DISABLED}"
      boss_group_thread_count: "${NETTY_BOSS_GROUP_THREADS:1}"
      worker_group_thread_count: "${NETTY_WORKER_GROUP_THREADS:12}"
      max_payload_size: "${NETTY_MAX_PAYLOAD_SIZE:65536}"
      so_keep_alive: "${NETTY_SO_KEEPALIVE:false}"

How should I change those parametters and what benefits can I expect from this changes (better results or it depends)?

Thanks in advance

pon0marev commented 1 day ago

boss_group_thread_count - can speed up the processing of new connections if the server handles a large number of clients. Increasing the number of threads may increase resource consumption. worker_group_thread_count - more worker threads can help process a large number of messages faster, which increases performance under high MQTT traffic. However, too many threads can reduce overall performance if the system is CPU limited.

Standard settings can handle a large number of devices and do not require modification. However, you can experiment with the settings to find the optimal balance between performance and resource utilization.