Skip to content
This repository has been archived by the owner on Feb 11, 2020. It is now read-only.

Constant load on pubsubCollection in mongodb #784

Open
einarnot opened this issue Feb 18, 2019 · 1 comment
Open

Constant load on pubsubCollection in mongodb #784

einarnot opened this issue Feb 18, 2019 · 1 comment

Comments

@einarnot
Copy link

einarnot commented Feb 18, 2019

Im running my mosca node js server on a raspberry pi zero, so resources are limited. I noticed using top that mongodb always use about 20% CPU, even when there is no messages sent over MQTT. When I run mongotop, I see that its the pubsubcollection that always has about 25ms of read activity.

Is there anyway to avoid the constant load on the pubsubcollection in mongodb?

Here are my settings:

var pubsubsettings = {
  type: 'mongo',               
  url: 'mongodb://localhost:27017/mqttdashboard',
  pubsubCollection: 'MqttPubSubCollection',
  mongo: {}
};

var moscaSettings = {
  port: 1883,         
  backend: pubsubsettings,
  persistence: {
   factory: mosca.persistence.Memory
  }
};
@einarnot einarnot changed the title Mongodb using a lot of resources Constant load on pubsubCollection in mongodb Feb 18, 2019
@ibrahim-sakr
Copy link

it will be better to have a way to inject an existing mongo Connection
as we have in attachHttpServer()
so if we can make something like attachMongoConnection()

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants