pdelvo / Pdelvo.Minecraft.Proxy

MineProxy.Net
MIT License
7 stars 0 forks source link

Lag and timeouts with a large amounts of joins #24

Closed ImDeity closed 12 years ago

ImDeity commented 12 years ago

I've done a few tests over the past couple weeks of the proxy with a subset of our server traffic and am having problems when 20-40 people join the server through the proxy.

There is a large amount of lag and many client disconnections with "read timeout"s when 20+ people are on/joining. It eventually settles down but while it's happening the CPU usage of the proxy also goes up pretty high (80%+ on a 3.4Ghz Xeon).

It is not a Bukkit issue as the same server can handle far more users joining when they connect directly. It also seems like the server itself responds but the proxy is stalling from time to time when a large amount of users connect.

If you would like additional information to help debug this, let me know. My guess would be that either the Minecraft authentication or some part of the network handling code isn't fully asynchronous and is causing the main proxy thread to stall.

pdelvo commented 12 years ago

Are they joining at the same time? Or does this also happen when they join with some time between it? What is the server OS? the windows client versions have limitations, and the proxy must have two connections open for each user.

Thank you for pointing me at this. I cannot test with many clients, because my computer has only 8 gigabytes of ram. I cannot start many minecraft clients

ImDeity commented 12 years ago

We have an "event" server where we host weekly Spleef tournaments and such so when it is started a bunch of people will join rapidly. It seems to happen when theres a large amount of people joining within the span of a few minutes. It doesn't seem to happen so much when the users have actually joined and the timeout/lag issues settle down after a few minutes.

The server OS of the server running the proxy is Windows Server 8.

I'm sure it'll be tricky to reproduce this bug yourself as it may require multiple Minecraft accounts. One way to load test may be to use a console based client (GUI/graphics-less) and script them to join rapidly in offline mode (something like https://github.com/shoghicp/Minecraft-PHP-Client-2)?

pdelvo commented 12 years ago

Can you please test this Version on this branch. I hope this helps: https://github.com/pdelvo/Pdelvo.Minecraft.Proxy/tree/less_threads

ImDeity commented 12 years ago

Compiled and tested just by myself and it seems to be losing connection a second or 2 after successfully logging in (the MOTD appears, sometimes 1 chunk loads, sometimes none of the map loads).

There wasn't any exception in the proxy console -- simply "lost connection" immediately after the "User[IP] is connected". The client eventually displays a message saying "Read timed out".

ImDeity commented 12 years ago

Also I just tested with nothing else running on the server with the precompiled alpha2 download you have and am noticing when a single user logs in (noone else on the server) the CPU usage spikes to 15-25% then settles down to 2-3% once the login is complete. This explains why when a bunch of people connect, the proxy lags -- the CPU usage from each login probably maxes out the CPU.

pdelvo commented 12 years ago

Really strange. this works well for me with up to 7% cpu load on my "slow" q6600. and it takes 7% cpu load when it does it the fastest it can.

Does the Server Version in the config match the real Server Version? Here is a overfiew of possible Version numbers: https://github.com/pdelvo/Pdelvo.Minecraft.Proxy/wiki/Minecraft-Versions

pdelvo commented 12 years ago

Oh got the Problem too now. this is not related to the performanece Change. I made a mistake at the Pickup spawn packet to target the newest pre Version. I breaked old ones. I had no pickups in my world so i had no probs when i tested it first. Im working on it

pdelvo commented 12 years ago

Does this work now for you? And what about Performance?

ImDeity commented 12 years ago

Testing it as I write this and so far it seems to not only be working but also the lag issues seem to be virtually non-existent with around 30 players joining rapidly.

I did notice a slight delay (about 10 seconds or so) when everyone was logging in before the terrain load came through but it was nowhere near as bad as it used to be where the server would be unusable or timeout players for a few minutes while all the players joined. Nice work!

Edit: I'll run a larger test in the next 7 days.

Edit 2: 2 exceptions (proxy continued to run fine after these so not a big deal):

http://pastebin.com/raw.php?i=q288uMPg

http://pastebin.com/raw.php?i=KS8HA2g8

pdelvo commented 12 years ago

I Close this issue and created a new one. posting everything in here gets unorganized :/