Advertisement

What UDP networking-libraries for networking do you use serverside in 2021 ?

Started by March 02, 2021 07:49 AM
40 comments, last by taby 3 years, 7 months ago

@taby thanks, am working on linux though so cant use the winsock thing, but am not sure i like the idea of spawning threads in the thousands like that but maybe im wrong - but if you are testing this with many clients it would be cool if you can add some benchmarks to your code so the difference can be seen ex speed going from single thread vs multithread and what you gain from it ?

Thanks for the reply.

Winsock is not much different than *nix sockets, so most of the code is cross-platform.

As far as comparisons go, my single-threaded code is roughly the same speed as my multi-threaded code. I haven't tested it with 10000 threads, mind you.

Single-thread: https://github.com/sjhalayka/udpspeed_2

Multi-threaded: https://github.com/sjhalayka/udpspeed3_multithreaded

Advertisement

P.S. I use the local loopback address (localhost), and it gets up to roughly 800 megabits per second using either code. This is on a business-class desktop machine; not the fastest piece of hardware out there. LOL

10,000 threads is a bad idea. In the best of worlds, you have one thread per core. One thread per connection is a fairly common idea but is generally thought of as a mistake by those who try it :-)

enum Bool { True, False, FileNotFound };

taby said:

P.S. I use the local loopback address, and it gets up to roughly 800 megabits per second using either code.

@taby thanks for your effort here but i am really after production experience and architecture and concepts here on which approach to go - and not just tested on loopback :D not meant as an offense but i am really interested in some experiences from production here and concepts, i can easily do a client/server model that works with 10 players, its whats happening when we scale - and i am sceptical about the wild usage of threads just dont think thats the way to go at least from the perspective that at some point it probably wont scale.

and btw : IF you end up coding on - then make it crossplatform with the #ifdefs around the socket part its quite standard ?

hplus0603 said:

10,000 threads is a bad idea. In the best of worlds, you have one thread per core. One thread per connection is a fairly common idea but is generally thought of as a mistake by those who try it :-)

This is great advice. Thank you. I will work on udpspeed_4, which will detect the core count, and launch that many threads. Once those threads are running, each thread will be fed packets from arbitrary IP addresses.

Advertisement

hplus0603 said:

10,000 threads is a bad idea. In the best of worlds, you have one thread per core. One thread per connection is a fairly common idea but is generally thought of as a mistake by those who try it :-)

@hplus0603 thats been breastfed into me too - hope you have and wanna take the time to look at my previous post with a few questions if they makes sense

joopyM said:

taby said:

P.S. I use the local loopback address, and it gets up to roughly 800 megabits per second using either code.

@taby thanks for your effort here but i am really after production experience and architecture and concepts here on which approach to go - and not just tested on loopback :D not meant as an offense but i am really interested in some experiences from production here and concepts, i can easily do a client/server model that works with 10 players, its whats happening when we scale - and i am sceptical about the wild usage of threads just dont think thats the way to go at least from the perspective that at some point it probably wont scale.

and btw : IF you end up coding on - then make it crossplatform with the #ifdefs around the socket part its quite standard ?

The best of luck to you!

taby said:

joopyM said:

taby said:

P.S. I use the local loopback address, and it gets up to roughly 800 megabits per second using either code.

@taby thanks for your effort here but i am really after production experience and architecture and concepts here on which approach to go - and not just tested on loopback :D not meant as an offense but i am really interested in some experiences from production here and concepts, i can easily do a client/server model that works with 10 players, its whats happening when we scale - and i am sceptical about the wild usage of threads just dont think thats the way to go at least from the perspective that at some point it probably wont scale.

and btw : IF you end up coding on - then make it crossplatform with the #ifdefs around the socket part its quite standard ?

The best of luck to you!

@taby didnt mean it as being rude or anything its cool you work on this and might be helpful too but there are just so many aspects in this where its easy to start where everything is working in an ideal world (LAN/loopback/few players) and then things starts breaking up badly as soon as you scale - thats the thing i would like to try to avoid. So not meant as an offense in any way.

No worries! To be fair though, I used to be a WAN analyst. ?

This topic is closed to new replies.

Advertisement