# Configuration

NanoMQ provides several options for optimizing performance according to your system.

# Configure method

NanoMQ can start with contents of configure file named config.cmake.in.

$PROJECT_PATH/nanomq/build$ cmake -DCFG_METHOD=FILE_CONFIG ..

Of course, NanoMQ can start with cmake-gui or cmake with arguments.

$PROJECT_PATH/nanomq/build$ cmake -DCFG_METHOD=CMAKE_CONFIG ..

# Arguments

limiting the number of threads:

$PROJECT_PATH/nanomq/build$ cmake -G Ninja -DCFG_METHOD=CMAKE_CONFIG -DNNG_RESOLV_CONCURRENCY=1 -DNNG_NUM_TASKQ_THREADS=5 -DNNG_MAX_TASKQ_THREADS=5 ..
1

For debugging, NanoMQ has a debugging system that logs all information from all threads. Which is aligned with Syslog standard. And you can disable/enable it by:

$PROJECT_PATH/nanomq/build$ cmake -G Ninja -DCFG_METHOD=CMAKE_CONFIG -DNOLOG=1  ..
$PROJECT_PATH/nanomq/build$ cmake -G Ninja -DCFG_METHOD=CMAKE_CONFIG -DNOLOG=0  ..
1
2

Message queue support:

For macos, mqueue is not support, you can set -DMQ=0 to disable it. It is enabled by default.

$PROJECT_PATH/nanomq/build$ cmake -G Ninja -DCFG_METHOD=CMAKE_CONFIG -DMQ=1  ..
$PROJECT_PATH/nanomq/build$ cmake -G Ninja -DCFG_METHOD=CMAKE_CONFIG -DMQ=0  ..
1
2

System tunning parameters:

set max size of fixed header + variable header for MQTT packet , default is 64 bytes

$PROJECT_PATH/nanomq/build$ cmake -G Ninja -DCFG_METHOD=CMAKE_CONFIG -DNANO_PACKET_SIZE=set ..
1

set max fixed header size for MQTT packet, default is 5.

$PROJECT_PATH/nanomq/build$ cmake -G Ninja -DCFG_METHOD=CMAKE_CONFIG -DNANO_HEADER_SIZE=set ..
1

set max property size for MQTT packet, default is 32

$PROJECT_PATH/nanomq/build$ cmake -G Ninja -DCFG_METHOD=CMAKE_CONFIG -DNANO_PROPERTY_SIZE=set ..
1

set queue length for QoS message, default is 64

$PROJECT_PATH/nanomq/build$ cmake -G Ninja -DCFG_METHOD=CMAKE_CONFIG -DNANO_QOS_LEN=set ..
1

set queue length for resending message, default is 64

$PROJECT_PATH/nanomq/build$ cmake -G Ninja -DCFG_METHOD=CMAKE_CONFIG -DNANO_MSQ_LEN=set ..
1

set nano qos timer, default is 30 seconds

$PROJECT_PATH/nanomq/build$ cmake -G Ninja -DCFG_METHOD=CMAKE_CONFIG -DNANO_QOS_TIMER=set ..
1

set logical concurrency limitation by -DPARALLEL, default is 32

$PROJECT_PATH/nanomq/build$ cmake -G Ninja -DCFG_METHOD=CMAKE_CONFIG -DPARALLEL=32 ..
1

For more information about these parameters, please refer to the project's Wiki