chronoxor / NetCoreServer

Ultra fast and low latency asynchronous socket server & client C# .NET Core library with support TCP, SSL, UDP, HTTP, HTTPS, WebSocket protocols and 10K connections problem solution
https://chronoxor.github.io/NetCoreServer
MIT License
2.63k stars 550 forks source link

latency in reception of the first UDP frames (lazy?) #291

Open c10ud opened 5 months ago

c10ud commented 5 months ago

Hello,

I made a test program which simply spawns an UDP server and compares the time in milliseconds between what's contained in the payload of the received frames and the time the comparison happens. The frames are sent by another process running on the same machine.

What happens is that after starting listening, the first few received frames present an higher latency, then quickly the system is able to pin it down to 1ms or less.

I suspect it is due to lazy loading of something. maybe in NET internals (since I get the same behaviour with plain NET8)..subsequent restarts of the server achieve full speed from the start.