moscajs / aedes

Barebone MQTT broker that can run on any stream server, the node way
MIT License
1.79k stars 231 forks source link

Problem feedback #966

Open it16888 opened 2 months ago

it16888 commented 2 months ago

I deployed a simple gateway service using aedes 0.51.2, with no additional logic. I simply started a gateway on port 1883, and currently have around 250,000 connections.However, I found that when the number of MQTT connections is stable, the server memory will continue to grow, from 700M to 900M starting from 1, and even continue to grow.Has anyone encountered a similar problem?

image

image

image

robertsLando commented 2 months ago

@it16888 What persistence/mqemnitter are you using?

it16888 commented 2 months ago

@it16888 What persistence/mqemnitter are you using? I did not specifically specify persistence/mqemnitter, here is my code. I don't know where the problem lies

const {createBroker} = require('aedes') const id = String(process.pid) const broker = createBroker({id}) const server = require('net').createServer(broker.handle) server.listen(port, () => { console.log('server started and listening on port 1883') })

robertsLando commented 2 months ago

@it16888 if using aedes with clusters you should use redis/mongodb persistence and emitters

it16888 commented 2 months ago

@it16888 if using aedes with clusters you should use redis/mongodb persistence and emitters

Dear, I am not currently working on a cluster and do not use Redis or MongoDB. I just need to keep the client connected and can obtain the corresponding message by listening for events (client '|'clientRead' |'clientDisconnect '|'ckeepaliveTimeout | ping). What do I need to do? I also need to avoid the problem of memory getting bigger and bigger

robertsLando commented 2 months ago

Clusters will not work as you expect without those storages: https://github.com/moscajs/aedes#clusters

it16888 commented 2 months ago

Clusters will not work as you expect without those storages: https://github.com/moscajs/aedes#clusters

Dear, I followed your advice and used aedes persistence moddb+mqemitter moddb. I use 20000 clients and send 20000 messages to the server per second. I see that the memory is still constantly increasing.