update documents

This commit is contained in:
skywind3000 2016-02-19 15:55:40 +08:00
parent d757d5ab4c
commit 23a8bda708

View File

@ -112,7 +112,8 @@ TCP是为流量设计的每秒内可以传输多少KB的数据讲究的
kcp->rx_minrto = 10; kcp->rx_minrto = 10;
``` ```
# 更多内容
# 文档索引
协议的使用和配置都是很简单的,大部分情况看完上面的内容基本可以使用了。如果你需要进一步进行精细的控制,比如改变 KCP的内存分配器或者你需要更有效的大规模调度 KCP链接比如 3500个以上或者如何更好的同 TCP结合那么可以继续延伸阅读 协议的使用和配置都是很简单的,大部分情况看完上面的内容基本可以使用了。如果你需要进一步进行精细的控制,比如改变 KCP的内存分配器或者你需要更有效的大规模调度 KCP链接比如 3500个以上或者如何更好的同 TCP结合那么可以继续延伸阅读
@ -123,50 +124,39 @@ TCP是为流量设计的每秒内可以传输多少KB的数据讲究的
- [应用层流量控制](https://github.com/skywind3000/kcp/wiki/Flow-Control-for-Users) - [应用层流量控制](https://github.com/skywind3000/kcp/wiki/Flow-Control-for-Users)
- [性能评测](https://github.com/skywind3000/kcp/wiki/KCP-Benchmark) - [性能评测](https://github.com/skywind3000/kcp/wiki/KCP-Benchmark)
# 相关应用 # 相关应用
- [dog-tunnel](https://github.com/vzex/dog-tunnel): GO开发的网络隧道使用 KCP极大的改进了传输速度并移植了一份 GO版本 KCP - [dog-tunnel](https://github.com/vzex/dog-tunnel): GO开发的网络隧道使用 KCP极大的改进了传输速度并移植了一份 GO版本 KCP
- [lua-kcp](https://github.com/linxiaolong/lua-kcp)KCP的 Lua扩展用于 Lua服务器 - [lua-kcp](https://github.com/linxiaolong/lua-kcp)KCP的 Lua扩展用于 Lua服务器
- [asio-kcp](https://github.com/libinzhangyuan/asio_kcp): 使用 KCP的完整 UDP网络库完整实现了基于 UDP的链接状态管理会话控制KCP协议调度等 - [asio-kcp](https://github.com/libinzhangyuan/asio_kcp): 使用 KCP的完整 UDP网络库完整实现了基于 UDP的链接状态管理会话控制KCP协议调度等
# 性能比较 # 协议比较
如果不丢包那么 KCP和 TCP性能差不多KCP不会有任何优势但是网络会卡造成卡的原因就是丢包和抖动有同学在内网这样好的环境下没有用任何丢包模拟直接跑跑出来的数据是差不多的但是放到公网上放到3G/4G网络情况下差距就很明显了公网在高峰期有平均接近10%的丢包wifi/3g/4g下更糟糕这正是造成各种网络卡顿的元凶。 如果不丢包那么 KCP和 TCP性能差不多KCP不会有任何优势但是网络会卡造成卡的原因就是丢包和抖动有同学在内网这样好的环境下没有用任何丢包模拟直接跑跑出来的数据是差不多的但是放到公网上放到3G/4G网络情况下差距就很明显了公网在高峰期有平均接近10%的丢包wifi/3g/4g下更糟糕这正是造成各种网络卡顿的元凶。
感谢 [asio-kcp](https://github.com/libinzhangyuan/asio_kcp) 的作者 [zhangyuan](https://github.com/libinzhangyuan) 对 KCP 与 enet, udt做过的一次横向评测结论如下 感谢 [asio-kcp](https://github.com/libinzhangyuan/asio_kcp) 的作者 [zhangyuan](https://github.com/libinzhangyuan) 对 KCP 与 enet, udt做过的一次横向评测结论如下
- ASIO-KCP has good performace in wifi and phone network(3G, 4G). - ASIO-KCP **has good performace in wifi and phone network(3G, 4G)**.
- Extra using 20% ~ 50% network flow for speed improvement. - Extra using 20% ~ 50% network flow for speed improvement.
- The kcp is the first choice for realtime pvp game. - The kcp is the **first choice for realtime pvp game**.
- The lag is less than 1 second when network lag happen. 3 times better than enet when lag happen. - The lag is less than 1 second when network lag happen. **3 times better than enet** when lag happen.
- The enet is a good choice if your game allow 2 second lag. - The enet is a good choice if your game allow 2 second lag.
- UDT is a bad idea. It always sink into badly situation of more than serval seconds lag. And the recovery is not expected. - **UDT is a bad idea**. It always sink into badly situation of more than serval seconds lag. And the recovery is not expected.
- enet has the problem of lack of doc. And it has lots of functions that you may intrest. - enet has the problem of lack of doc. And it has lots of functions that you may intrest.
kcp's doc is chinese. - kcp's doc is chinese. Good thing is the function detail which is writen in code is english. And you can use asio_kcp which is a good wrap.
Good thing is the function detail which is writen in code is english. And you can use asio_kcp which is a good wrap.
- The kcp is a simple thing. You will write more code if you want more feature. - The kcp is a simple thing. You will write more code if you want more feature.
- UDT has a perfect doc. UDT may has more bug than others as I feeling. - UDT has a perfect doc. UDT may has more bug than others as I feeling.
具体见:[横向比较](https://github.com/libinzhangyuan/reliable_udp_bench_mark/blob/master/bench_mark.md) 和 [这里](https://github.com/skywind3000/kcp/wiki/KCP-Benchmark)。截取一段在网络糟糕时asio-kcp/enet的延迟数据 具体见:[横向比较](https://github.com/libinzhangyuan/reliable_udp_bench_mark) 和 [评测数据](https://github.com/skywind3000/kcp/wiki/KCP-Benchmark),为犹豫选择的人提供了更多指引。
```cpp
worst network lag happen:
asio: 10:51.21
291 295 269 268 231 195 249 230 225 204
enet: 10:51.21
1563 1520 1470 1482 1438 1454 1412 1637 1588 1540
```
我当年主要测试了 KCP和 TCP/UDT的比较扫了一眼 libenet觉得协议实现中规中矩缺乏很多现代传输协议的技术所以并没有详细测试。而 asio-kcp的作者同时给出了KCP/enet/udt三者的详细比较为更多犹豫选择使用那一套的人提供了更多指引。
# 欢迎捐赠 # 欢迎捐赠
![欢迎使用支付宝对该项目进行捐赠](https://raw.githubusercontent.com/skywind3000/kcp/master/donation.png) ![欢迎使用支付宝对该项目进行捐赠](https://raw.githubusercontent.com/skywind3000/kcp/master/donation.png)
欢迎使用支付宝手扫描上面的二维码,对该项目进行捐赠。捐赠款项将用于改进 KCP性能以及 欢迎使用支付宝手扫描上面的二维码,对该项目进行捐赠。捐赠款项将用于持续优化 KCP协议以及完善文档。
后续持续优化。
欢迎关注 欢迎关注