Mosquitto is slow when used in localhost mode

Hello,

We are doing speed and load tests using the broker Mosquitto. The tests consists of continuously sending messages both ways from a client A to a client B using the broker.

We notice a speed issue when we use the broker in localhost with qos=0. There is a huge slowdown in messages speed.

When the broker is used in remote mode (Broker on a server, clients on another machine), we reach around 12000 messages/s.
When the broker is used in local mode (Broker and clients on localhost), we reach only around 400 messages/s.

We have no speed issue with qos=1 or qos=2 in localhost.
Technically, we hope qos=0 being faster.

We tried modifying the following parameters in the moquitto.conf file without success :

max_queued_messages 0
queue_qos0_messages true
set_tcp_nodelay true

The machine where the broker is installed runs Red Hat Enterprise Linux 8.6 with 64 bits architecture.

We have the following limitations configuration on the machine :

core file size (blocks, -c) unlimited
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 63164
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 65536
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 63164
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited

We tried with Mosquitto 2.0.15 and also latest Mosuiqtto 2.0.18 version.

Are there any other parameters or limitations that should be checked? Or something else in the parameters or maybe the API?

Any help would be appreciated.

Thanks you.