freyacodes / archived-bot

A Discord music bot serving music in over 3 million discord servers
https://fredboat.com/docs
MIT License
488 stars 207 forks source link

Player throttling #44

Open freyacodes opened 7 years ago

freyacodes commented 7 years ago

It's a known fact that FredBoat sometimes suffers from extreme load causing the bot to stutter since it can't process music fast enough.

I want to create a system that throttles a number of players being actively used based on the CPU usage of the nodes.

I'm thinking the bot would reject new players from starting if the average node CPU usage is >98%. Paused players should be given a grace period of a few minutes to not introduce a fear of losing the right to play music when pausing.

If access is rejected the bot would instead send a message explaining the situation and how they can help.

knight-ryu12 commented 7 years ago

IDEA: make thread that constantly reads CPU usage...

freyacodes commented 7 years ago

Lavaplayer already does this for the remote nodes I am interested in.

schnapster commented 7 years ago

Info for anyone touching this in the future: check the NodesCommand class on how to access information from the nodes