I'm building the networking for an MMO engine and am working on tuning the TCP performance. In wireshark, I've been seeing slowdown scenarios like this:
T=0ms: Client sends 29 packets with len=500
(sends are accumulating)
T=54ms: Client receives acks for all 29
T=54ms+: Client starts sending again with len=1460
There's 2 things going on here:
- It seems like the send buffer is getting full (I can send just about 16kb before it starts waiting).
- Messages are being packed into max-MTU packets if there's multiple messages available (I static-compiled SDL_Net with TCP_NoDelay to make sure Nagle's was disabled.)
I don't care much about the latter since it isn't waiting, it would just be good to know what mechanism is doing it in case it needs to be tuned also.
For #1, it doesn't seem like SDL_Net gives me a way to adjust the buffer size. Am I missing something? If not, what are my best options for moving forward?
Things I'm considering:
- I could fork SDL_Net, it seems simple enough that maintenance wouldn't be that bad. I'd be in the realm of writing platform-specific tuning code though, which I'd rather not do.
- ENet seems interesting. I've been avoiding UDP to save on implementation complexity, since I likely won't need the performance, but this could be a way to go. (Edit: Also noticed that valve put out a lib https://github.com/ValveSoftware/GameNetworkingSockets)
- I could roll my own reliable UDP (again, trying to avoid this).
- Other libraries?