RAM usage problem

Hello. I’m Discord Bot Owner, which is on 53 servers, and I’m concerned that the bot is using too much RAM. How can I fix it?

The more servers a Discord bot is in, the more RAM it uses. Someone told me that a bot with I think 2 shards take 8GB for them so they use a VPS.

The problem might also be a memory leak or something.

You can boost your app I guess…

Move some stuff to a disk database. Some things you don’t nesscarily need to store in memory. I’m not exactly sure what discordjs/eris needs to use ram for each server for(cache maybe you can try making them smaller).

How can I detect memory leaks?

I think the error event will send a information about the memory leak if there any.
It should be like this:

(node:929) MaxListenersExceededWarning: Possible EventEmitter memory
leak detected. 11 message listeners added to [Client]. Use
emitter.setMaxListeners() to increase limit

I am facing similar issues for my bot and its at 150 servers now and with or without DB removing all packages … i have tried everything theirs something with increase in servers its just eating a lot of RAM what could be the issue? Discord.js?

Maybe the library is eating a lot of ram.

i checked my packages all are fine … if it is the library then it should be discord.js which is needed for the BOT :confused:

How much ram is it using?

Around 200-300MB RAM.

Mine at 150 Servers its taking 400MB+
with reaching 170+ Servers it is exceeding 512MB limit
It keeps force closing the bot and restarts it … kinda annoying

i would highly recommend switching to a vps at that point

1 Like

yea i agree with you but i believe i dont got sufficient cash to apply for it

I would reccomend that you set up something like Buy Me a Coffee to get donations from people who use your bot.

The more servers a Discord bot is in, the more RAM it uses. Someone told me that a bot with I think 2 shards take 8GB for them so they use a VPS.

Depends totally on how the bot is coded, I have a bot with 3 shards which only uses ~1gb of memory

1 Like

Depends totally on how the bot is coded, I have a bot with 3 shards which only uses ~1gb of memory

How do you optimized bot?

Save nothing in cache but local db

Which db engine do you recommend? And how to save in local db? i mean bot stuff

Just use sqlite