xlash123 / KHUx-Discord-Bot

A Discord bot that will aid players in getting information about the mobile game Kingdom Hearts Union X.
12 stars 7 forks source link

90% CPU usage when running this bot #8

Closed heyitswither closed 7 years ago

xlash123 commented 7 years ago

What are you specs? And is this when idle or running a command?

heyitswither commented 7 years ago

@xlash123 I am running it on a VPS with 1 CPU core at 2.4Ghz and 512MB of ram. I'm getting 90% CPU usage at idle.

xlash123 commented 7 years ago

I'll see what optimizations I can make, but it's probably attributed with the low specs of the VPS.

heyitswither commented 7 years ago

@xlash123 well I'm running 4 other bots and collectively they're only using 10%

xlash123 commented 7 years ago

That's Java for ya.

heyitswither commented 7 years ago

Ok, well then I think I'll just have to rewrite it in python.

xlash123 commented 7 years ago

Leave the issue open. I'll do what I can to make this run better. I wasn't aware it took up that much CPU usage. I'm only running this bot on my VPS.

KW29 commented 7 years ago

@xlash123 Yeah im running this on my home server that i use for Movies and music, it runs an I7 4790k @ 4.00 Ghz with 32gb of ram and this bot somehow uses 30% of my cpu all the time, even while in idle, heck even tho i have water cooled cpu the core package temp goes up by 20 to 25 degrees when this thing is running idle, i guess that due to the cpu load and hopefully can be fixed

Other than that great bot tho very helpful in a pinch

ivivaitylin commented 7 years ago

I'm running this on a free EC2 vpn, and can't use version 1.2.4 since the new search feature is too much for it. Getting a medal name wrong and the bot will spent a couple of minutes at 100% cpu attempting to check every medal name at roughly 1 name per second. Additionally attempting to run the !refresh command seems to make it completely unresponsive, even after letting it run overnight. The bot prints the 'updating medal list' to chat, and the console shows it's keeping the connection open or whatever it does, but it just doesn't finish refreshing and won't respond to further commands. I would post this as a separate bug report, but I figured it's tied into the CPU limitation.

xlash123 commented 7 years ago

That's odd, since I run the same exact thing and it works fine for me. Try restarting, as that fixed my slow issues. I'll still do my best to fix this issue

KW29 commented 7 years ago

@xlash123 Actually now that @ivivaitylin mentions it, the !refresh command makes the bot unresponsive for me too, it keeps the connection open and sending the heart beats, but the bot becomes completely unresponsive after the !refresh command

xlash123 commented 7 years ago

I'll check on that. I'm currently away from home, so I'll work on that on Friday.

xlash123 commented 7 years ago

On the free tier VPS on AWS, I'm running idle at 1% usage and when I make it search, I get a maximum of around 15%. I'll still do some optimizations, but I'm not sure why my VPS isn't reacting as bad as you guys have said. If you're still experiencing bad performance, try updating Java and restarting your system, and I'll push out an update when I make some optimizations. @heyitswither @KW29 @ivivaitylin

xlash123 commented 7 years ago

I've done some optimizations on the idle load by reducing the amount of threads. Hopefully that helps. I've also fixed the !refresh bug, a dumb mistake on my end. I'm gonna close the issue. If it persists, open it back up and I'll continue to do what I can.