Mosquitto broker takes heaps of CPU

Asked by Jianing Ren

Hi All,

I am currently doing a pressure testing for mosquitto broker and my web service. And I have written a network Simulator to simulate a large volume of simultaneous connections to the broker.

The testing I have done starts with mosquitto already takes CPU usage of 40%, roughly 1800 clients( inactive), while the active clients remain 2~3.

Then I do a 200 simultaneous connections with clean-session set to true the CPU usage increases to 50% , and then I disconnect all those connections.

So after I have done the testing above the connection state remain almost the same in terms of the number of inactive clients(1800 ) and active clients(2), however the CPU usage of broken increases a lots even after those connections have been disconnect.

So I am wondering is this normal ? How long it takes to have the increased CPU back to normal since those active clients have been disconnected? Or is there any way to control the broker cpu usage ?

Updates:

I have restarted broker and done a fresh testing base on the 1000 clients (clean session ALL set to true), this time, when all those clients are connecting and publish messages, the CPU usage for broker keeps 50%, which is fine.

And after all the messages have finished publishing then killed all the connections , the CPU drops to an idle stage (3.0%)

So I do not understand the difference behind the story between clients with clean session set to false and those set to true.

It seems like the broker is doing something ongoing and continuously if there are durable clients, even they are NOT active and connected at the moment.

Could anyone tell me the difference and how broker deal with durable clients when they are not connected?

Thanks,

Johnny Ren

Question information

Language:
English Edit question
Status:
Solved
For:
mosquitto Edit question
Assignee:
No assignee Edit question
Solved by:
Jianing Ren
Solved:
Last query:
Last reply:
Revision history for this message
Roger Light (roger.light) said :
#1

Hi there,

Which version of mosquitto are you using?

Cheers,

Roger

Revision history for this message
Jianing Ren (jianingr) said :
#2

Hi Roger,

Thanks for your reply. The version is 1.2.3.

Thanks,

Johnny

Revision history for this message
Jianing Ren (jianingr) said :
#3

Hi Roger,

Does it get anything to do with the version? I have not tried this on other versions.

Thanks.

Revision history for this message
Roger Light (roger.light) said :
#4

Well lots of things change between versions, so it's certainly a
possibility.

I would definitely try 1.3.5, which is the latest. If you can try the 1.4
branch as well (or instead) that would be the most helpful. There have been
a lot of background changes that should reduce the potential for this sort
of problem.

Revision history for this message
Jianing Ren (jianingr) said :
#5

Thanks for your reply,Roger!
I will try the latest version today.

Regard,