taby said:
Neither the server or the client emulation is multithreaded, the client code uses asyncio and the server runs on a single thread.
I'm not sure/don't really think load balancing is viable for our/this game.
I call select before I call recvfrom. Non-blocking behaviour is basically asynchronous behaviour, right?
I'm not the right person to comment on this generally speaking, but asynchronous in Python basically means virtual multithreading, or that's how I understand it. It allows you to slip in and out of functions with their contexts (variables etc) at any arbitrary position, switching to another task/function/position, and switch back again within microseconds.
I really only had the subject of stresstesting the server in mind, load balancing seems like a secondary concern after getting the stresstesting working which I wasn't sure you had in the beginning.
Yes, the original UDP speed tester that I wrote like 20 years ago was single-threaded, and there was no load balancing – https://github.com/sjhalayka/udpspeed
I used this original UDP code to stress test fibre lines. Our ISP must have been metering the line because damned if we didn't get a result of 100 Mbits/second on the nose LOL.
Anyway, now I'm on version 5, which is multi-threaded and has load balancing. All the versions are on my GitHub.
Cool. Sounds like you probably know more C than I do if you wrote that 20 years ago. I wrote hello world 20 years ago by copying code from an outdated book on C++. Never really learned much more than that in C until a year or two ago when I decided to write my own simplified MMO game server.
P.S. I see that current (circa 2021) AMD Threadripper CPUs have like 128 threads. Why not take advantage of that?
It depends on what you're doing with it. Multithreading has their drawbacks: 1) Complexity of code (original server codebase is already 100k lines of C++ designed only for single threaded use), 2) Overhead.
I use multiple cpu threads for map loading, that's it.
And again the reason I don't use it for anything else like I explained earlier is that the server I use (the core design of the game) is that it's completely synchronous except for strictly speaking client-server latency.
There is no player movement, map updates, conversations, nothing without the server first saying “go”, and the client (slave) drawing the change.
For this model I suspect multithreading will virtually never pay off (might be wrong, but that's what I suspect, most certainly with the language I use), only for server-client pairing where asynchronous behavior is allowed.
Not to mention a single server is already capable of hosting approximately 3000 players. How many more players does one need. If I get 3000 players I'll be happy with that :D