stunserver icon indicating copy to clipboard operation
stunserver copied to clipboard

Performance at high loads

Open eTiMaGo opened this issue 1 year ago • 2 comments

Is there a theoretical limit to how many requests per second the server can handle? I'm running this on a Ubuntu 22baremetal server with plenty of hardware capacity, in a CDN + P2P video streaming setup (https://github.com/Novage/p2p-media-loader).

Once we have about 40,000 viewers, the server seems to struggle, But CPU and RAM usage are nearly idle.

Is there anything I can do to increase this?

eTiMaGo avatar Mar 02 '23 10:03 eTiMaGo

Hi there @eTiMaGo

Before I renamed the DNS entry form stun.stunprotocol.org to stunserver.stunprotocol.org, the t3.small instance of the public STUN server on AWS served between 200 million and up to 1.4 billion STUN requests per day: https://imgur.com/a/2JiTsJX

These are insane numbers because STUN binding requests are just a handful per P2P/WebRtc session.

STUN doesn't have any impact on media quality. So when you say "struggle", that implies that there are other issues at play here. Can you elaborate on that? Why do you think the STUN server is having an issue? Please define "struggle".

Obviously, if you need more STUN capacity, you can deploy another server and use round-robin DNS to load balance. Another option is to use the "development" branch from this project. There's a command line option called --threading where you can specify the number of threads (CPU cores) you want to consume. That's what's deployed now. I use --threading 2. But I suspect this isn't the issue.

Please let me know more details.

jselbie avatar Mar 02 '23 11:03 jselbie

OK, that is interesting, from my monitoring, I can reach about 220k packets/sec then the network bandwidth just drops out, like at 2:40 on the following graph:

https://imgur.com/pyBtgYD

During this time, the number of viewers is steady

That being said, since my post, I have been digging more into my trackers configuration, this seems more likely to be the bottleneck. I'm also hosting this server at OVH, it's possible the increased traffic triggered their automatic firewall.

Anyway thanks for the quick reply!

eTiMaGo avatar Mar 02 '23 15:03 eTiMaGo