moscajs / mosca

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

High CPU usage on macOS #566

Open ajitam opened 7 years ago

ajitam commented 7 years ago

Hello,

I've been using Mosca for some time know on different ENVs (macOS and Ubuntu). Last week I formatted my Macbook Pro and now whenever I ran nodejs script with Mosca inside node task in Activity monitor start burning 50% and more of CPU.

Is there any why I can somehow debug this?

Here is what I know:

thx, matija

ajitam commented 7 years ago

Ok, I might have found some more leads around this problem.

After some additional research I noticed that - if I ran the script with DB which already existed everything was 0K, but if I started script with new DB CPU usage got hight again. So naturally on newly formatted mac I didn't had any old DBs.

So bottom line: If I start mosca with backend using mongoDB (and use new DB name) CPU usage is hight (DB is created)

mcollina commented 7 years ago

@ajitam interesting. Is the CPU staying high, or does it lower after a while? Maybe there is a bug somewhere in the collection-creation logic. Would you like to try a PR? The problem is likely to be in https://github.com/mcollina/ascoltatori

ajitam commented 7 years ago
  1. As far as I can tell script is running on high CPU non-stop (I think I was running it for at least 2 hours)
  2. I can confirm the same behaviour on Ubuntu 16.04.1 LTS
  3. Regarding PR - frankly I'm not filling qualified for the task :/

p.s.: for now I have very dirty fix - I export mqtt DB from the server and import it into my local mongoDB