RevenantX / LiteNetLib

Lite reliable UDP library for Mono and .NET
https://revenantx.github.io/LiteNetLib/index.html
MIT License
3.06k stars 495 forks source link

How to testing server peformance with a lot of clients with less PC? #472

Closed fantasyz closed 2 years ago

fantasyz commented 2 years ago

Hi, I am trying to create many clients to test how things go on large scale. It is a test with a server and many client within a single PC.

However, when reaching about 5000 peers, the peer creation processing became very slow. Not sure if it is related to the large amount of threads created. Number of threads jump from ~5000 to 20k in Task Manager. (About 3 new threads per peer?)

The program can initially create approx 100-200 peers per second. However, when the client count reach around 5000, the spawn rate slow down very mush. Memory consumption doesn't seems like a problem.

I want to test with more clients, say 10K up, but it seems like the process will taking forever to reach that number. Is there anything I could do to improve the situation besides having more PC for spawn clients?

Library version: release version (0.9 indev)]

Framework: [.NET Framework]

OS: [Windows]

RevenantX commented 2 years ago

this is because of tons threads and context switching. You can try use ManualMode in library and distribute clients per processor cores/threads. Also for questions use discord