moscajs / mosca

MQTT broker as a module
mosca.io
3.2k stars 509 forks source link

Mosca keep accessing mongo? #556

Closed fastQM closed 7 years ago

fastQM commented 7 years ago

I just found that if I start mosca with mongo as the backend in my application, the process "mongod" will keep using 9.3%CPU If I remove the mosca service from the code, the process mongod will only use 1.1%CPU Why is that? 9.3% is too much.

My cpu is Intel 4 cores 2.24GHZ

mcollina commented 7 years ago

Use Redis instead of MongoDB. Mosca uses a tailable cursors (https://docs.mongodb.com/v3.2/core/tailable-cursors/) for new messages, which it might cause some CPU usage even if there is no traffic.