theusaf / kahoot.js-updated

Kahoot.js
MIT License
43 stars 22 forks source link

Preformance issues #19

Closed JeroenoBoy closed 4 years ago

JeroenoBoy commented 4 years ago

So im testing with making bots etc, but i release.. lets say 1000 bots in a kahoot. it starts to lagg at around 800, and it usually stops @ 950-1000. and after that, my internet crashes every time. close the process, doesnt help, restart fixes it. and no this isn't a problem on my system. i have GTX 1080 8GB VRAM, R5 1600 with 16 gigs of ram, and gigabit ethernet. and i already added some measures to not allow too many bots to join, max (30 at the same time)

On the other hand, i am a beginner in js

theusaf commented 4 years ago

Does the internet crash for all devices on your network? If so, it is likely your network being unable to handle all the sockets connecting. Otherwise, it could be that your gigabit Ethernet is not enough, or the process spawning all the bots can’t handle it properly. I'm not sure why after stopping the process, your network still doesn't work.

It might also help to split up the bots into multiple processes (with each process doing 50-100 bots each, rather than all 1000)

However, I'm not knowledgeable in this area, so don't take my word for it.

JeroenoBoy commented 4 years ago

The network crash stuff is only on my pc, I have the bot function async

theusaf commented 4 years ago

From my testing, the performance of multiple bots isn't too bad (40mb at 100 bots). How much ram/network does your bots use when you run it?

JeroenoBoy commented 4 years ago

500:

1000:

Also @ 1000: it took pretty long to join all of them, guess about 5 mins, didnt clock it though.

Also, maybe something im not seeing, but is there a propper way to make bots leave? or does it auto disconnect?

theusaf commented 4 years ago

To leave, you can do client.leave(), which should disconnect the bot instantly. If you just close the process, the bots will be disconnected from the game eventually.

For the bots taking a while to join, you might need to spawn multiple processes to spawn bots. (Research child_process and “sharding”) This should allow for faster joining, but will use a little more ram.

Looking at your previous comment, there isn’t really any performance issue, just a limitation with JavaScript.

JeroenoBoy commented 4 years ago

ok, thanks il look it up :D

JeroenoBoy commented 4 years ago

also, im getting a bunch of errors while executing many ath teh same time:

request error: Kahoot session header is undefined. (This normally means that the room no longer exists.) request error: Kahoot session header is undefined. (This normally means that the room no longer exists.) request error: Kahoot session header is undefined. (This normally means that the room no longer exists.) request error: Kahoot session header is undefined. (This normally means that the room no longer exists.) request error: Kahoot session header is undefined. (This normally means that the room no longer exists.)

theusaf commented 4 years ago

That is likely due to Kahoot having an anti-ddos system. If you want to send a lot of bots quickly, you have to have multiple servers. Otherwise, you need to limit how many bots you send per minute.

Sent over the interblag from a GUI. https://github.com/theusaf https://shortr.github.io/?llorkcir

On Jan 22, 2020, at 10:28 AM, JeroenoBoy notifications@github.com wrote:

 also, im getting a bunch of errors while executing many ath teh same time:

request error: Kahoot session header is undefined. (This normally means that the room no longer exists.) request error: Kahoot session header is undefined. (This normally means that the room no longer exists.) request error: Kahoot session header is undefined. (This normally means that the room no longer exists.) request error: Kahoot session header is undefined. (This normally means that the room no longer exists.) request error: Kahoot session header is undefined. (This normally means that the room no longer exists.)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

JeroenoBoy commented 4 years ago

or get a vpn? will hat also work or..?

theusaf commented 4 years ago

A vpn could work, but still could get blocked eventually.

Sent over the interblag from a GUI. https://github.com/theusaf https://shortr.github.io/?llorkcir

On Jan 22, 2020, at 10:34 AM, JeroenoBoy notifications@github.com wrote:

 or get a vpn? will hat also work or..?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

theusaf commented 4 years ago

Closing because main question was answered. Discussion will continue