Mosquitto broker takes heaps of CPU
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: