Show HN: KCP: a new low-latency, secure network stack
improbable.io
improbable.io
I understand the intent here is to suggest that some of the design decisions made over the past five decades don't align with the author's use case, but the fact TCP was originally implemented in the 1970's (though with many subsequent changes) isn't the problem.
Undeniably TCP's got some problems / features that aren't ideal now, but it's also acquired lots of extensions and knobs to turn to make it perform better in different environments.
For example:
> Amongst other techniques, KCP retransmits packets more quickly, anticipates packet loss before retransmission timeouts, and backs off more slowly when packet loss is detected.
SCPS [1] was designed (~15 years ago) to address some of the challenges with TCP on non-ideal networks - including slower backoff & more aggressive ramp up after packet loss. (Satellite comms throughput typically ends up looking like a sawtooth, meaning you waste a lot of bandwidth by TCP being overly cautious.)
I'm not suggesting it's a candidate for improving multiplayer game performance, just a nod to the fact some of these 'new' problems have been considered before.
[1] https://en.wikipedia.org/wiki/Space_Communications_Protocol_...
Check out the C library (MIT licensed) on Github:
Someone reinventing the wheel but not doing enough research to find the state of the art seems a bit odd, or amateurish.
Or that might be a strategy decision, because I believe their paid SpatialOS stuff competes with free enet-based plugins (e.g. Mirror) on the Unity asset store.
https://github.com/skywind3000/kcp/blob/master/README.en.md BTW has exactly the same diagram as this blog post, so even though it mentions enet, it does not show enet's performance in its comparison graph.
Plus it only mentions enet in the case of a (almost catastrophic) network failure where even KCP has a 1+ second ping. Playing any kind of online game with a ping above 0.5s is pure pain, so that situation is not a valid data point for arguing about KCP or enet's pros or cons.
To add additional detail, I'm currently using OpenMTCPRouter to bond 4G and DSL but it suffers when one connection starts experiencing packet loss.
There are plenty of guides out there that use shadowsocks which works well for web-browsing, but to be truly transparent need to just set a gateway to route via the tunnel. A docker image or a vm image that makes needs minimal config on both ends would be ideal. Has anyone done something similar?
"Optimization, again. TCP is implemented in the kernel and, in part, in the network card. When using TCP we can make one call to the kernel to hand it a large buffer of data and say “segment and package this as you see fit”. When using UDP, because we have to do that segmenting and packaging ourselves, we hand each packet individually the kernel. Each call to the kernel is expensive and the overhead becomes very significant, especially in Go. The kernel’s TCP stack is also highly optimized for performance while the kernel’s UDP stack is typically not."
It seems to replace TCPs retransmission of lost packets with erasure encoding, so single lost packets can be reconstructed from the packets that made it. That should provide a nice improvement in mobile or wireless networks.
Probably just a typo, but according to the article it actually runs on top of UDP, as an alternative to TCP.
but somewhere between yourself and any other node in the internet, packet loss is quite common.
It's not, they are re-transmitted just fine by TCP or over the protocol built on UDP.
Anyway, dropping packets over WAN is just a fact. If you don't think it happens then you are lucky enough to be able to ignore it.
If you also think it never happens on your LAN then either you have better networking than the best datacenters or you are relying on hardware and software so you never see it.
My point is, packets do not drop regularly for me. It's an exception rather than a rule. Spending a significant amount of traffic for error correcting codes which won't be used is a waste. Proper network stack should not enable this mode until actual packet drops are observed and should disable this mode if packets stop dropping. If a lot of packets are dropping, it might be worth to put even more error correcting codes, to be able to recover from two dropped packets, and so on.
This would be useful for real-time mobile apps. Do mobile connections even support UDP?
In theory, you could alternately build a new protocol directly on top of IP, just as TCP and UDP themselves are built, but middleboxes have a habit of dropping anything that's not TCP or UDP. Plus, unprivileged users on standard OSes can't send arbitrary IP packets, so it would require more setup for users.