From f91840bb505ac8765fc3c80dfea8e3d954eb91d7 Mon Sep 17 00:00:00 2001 From: Fredrik Olsson Date: Fri, 6 Oct 2023 08:41:55 +0200 Subject: [PATCH] Reconfiguring to not persist retained messages to disc. This effectively kills the perofrmance by excessive disk I/O... --- docker-compose.base.yml | 8 ++-- ...igrations.bats => 11-test-migrations.bats} | 0 tests/11-test-setup-persistence.bats | 40 ------------------- 3 files changed, 4 insertions(+), 44 deletions(-) rename tests/{12-test-migrations.bats => 11-test-migrations.bats} (100%) delete mode 100644 tests/11-test-setup-persistence.bats diff --git a/docker-compose.base.yml b/docker-compose.base.yml index a04d9d6..52261d1 100644 --- a/docker-compose.base.yml +++ b/docker-compose.base.yml @@ -47,12 +47,12 @@ services: environment: - EMQX_NAME=pontos-hub - EMQX_HOST=127.0.0.1 - # Retained messages will be persisted to disc to ensure they survive reboots etc - - EMQX_RETAINER__BACKEND__STORAGE_TYPE=disc # Do NOT allow for subscribers to upgrade QoS - EMQX_MQTT__UPGRADE_QOS=false # Rate limit the number of published messages per client on the ws listener - - EMQX_LISTENERS__WS__DEFAULT__MESSAGES_RATE="1000/s" + - EMQX_LISTENERS__WS__DEFAULT__MESSAGES_RATE="5000/s" + # Lets disable the force_shutdown feature to avoid kicking out publishers with a high burst rate of messages + - EMQX_FORCE_SHUTDOWN__ENABLE=false # Avoid queuing QoS0 messages - EMQX_MQTT__MQUEUE_STORE_QOS0=false # Configure logging @@ -168,7 +168,7 @@ services: - PG_CONNECTION_STRING=postgres://pontos_user:${PONTOS_DB_PASSWORD}@db:5432/pontos - PG_TABLE_NAME=vessel_data.master - PG_POOL_SIZE=3 - - PARTITION_SIZE=1000 + - PARTITION_SIZE=5000 - PARTITION_TIMEOUT=5 - DISCARD_NULL_VALUES=true depends_on: diff --git a/tests/12-test-migrations.bats b/tests/11-test-migrations.bats similarity index 100% rename from tests/12-test-migrations.bats rename to tests/11-test-migrations.bats diff --git a/tests/11-test-setup-persistence.bats b/tests/11-test-setup-persistence.bats deleted file mode 100644 index 24ad444..0000000 --- a/tests/11-test-setup-persistence.bats +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env bats - -load "./bats-helpers/bats-support/load" -load "./bats-helpers/bats-assert/load" - - -# In this file, no automatic setup is configured, a teardown is provided though, -# to make sure all tests leave a clean slate - -teardown() { - docker compose -f docker-compose.base.yml down --remove-orphans - docker container prune -f && docker volume prune -af -} - -@test "BASE: MQTT retain persistence across reboots" { - - # Start base setup - docker compose -f docker-compose.base.yml up -d - sleep 10 - - # Publish something with retain=true - run docker run --network='host' hivemq/mqtt-cli:4.15.0 pub -v -h localhost -p 80 -ws -ws:path mqtt -t anything/anything -m "Hello World!" --retain - assert_line --partial 'received PUBLISH acknowledgement' - - # Subscribe and check that we receive the retained message - run timeout --preserve-status 5s docker run --network='host' hivemq/mqtt-cli:4.15.0 sub -v -h localhost -p 80 -ws -ws:path mqtt -t anything/anything/# - assert_line --partial 'received SUBACK MqttSubAck{reasonCodes=[GRANTED_QOS_2]' - assert_line --partial 'Hello World!' - - # down and up - docker compose -f docker-compose.base.yml down - docker compose -f docker-compose.base.yml up -d - sleep 10 - - # Subscribe again and check that we receive the retained message - run timeout --preserve-status 5s docker run --network='host' hivemq/mqtt-cli:4.15.0 sub -v -h localhost -p 80 -ws -ws:path mqtt -t anything/anything/# - assert_line --partial 'received SUBACK MqttSubAck{reasonCodes=[GRANTED_QOS_2]' - assert_line --partial 'Hello World!' - -} \ No newline at end of file