Skip to content

Latest commit

 

History

History
78 lines (59 loc) · 3.67 KB

README.en.md

File metadata and controls

78 lines (59 loc) · 3.67 KB

java-Kcp

Powered

Kcp based on netty version (including implementation of fec function)

KCP is a udp-based fast and reliable protocol (rudp), which can reduce the average delay by 30% -40% at the cost of wasting 10% -20% of bandwidth over TCP, and reduce the maximum delay by three times the transmission effect.

maven repository:

<dependency>
  <groupId>com.github.l42111996</groupId>
  <artifactId>kcp-base</artifactId>
  <version>1.6</version>
</dependency>

compatibility:

  1. Compatible with c version of kcp
  2. fec implementation based on https://github.com/Backblaze/JavaReedSolomon
  3. Perfectly compatible C# version, https://github.com/l42111996/csharp-kcp, quickly build the network library before the game

optimization:

  1. Based on event-driven, make full use of multi-core
  2. Optimize fastack logic and reduce traffic by 10%
  3. Optimize the check function.
  4. Optimize collection iterators.
  5. Include fec to reduce latency
  6. With crc32 check
  7. Use the time wheel to optimize the CPU usage of a large number of connections
  8. Use directbuf and object pool, no gc pressure
  9. Increase the use of conv or ip + port to determine the uniqueness of the channel. The game is recommended to use conv and tcp configuration. Related information
  10. Changes in export ip such as 4G switching wifi when adding games will not cause disconnection

Using method and parameters

  1. Server-side example
  2. Client Example
  3. Best Practices
  4. A lot of information
  5. Compatible with C #, java server, c #Client
  6. Encountered problems
  7. Performance test results
  8. Compatible with kcp-go, including fec compatible

Test completed

  1. Single connection endless loop sending and receiving packet memory detection, performance test Configuration: mbp 2.3 GHz Intel Core i9 16GRam Single connection with fec 5W / s qps Single connection without fec 9W / s qps
  2. Java server and c # client compatibility test
  3. 3000 connections remain using single core 30% cpu
  4. fec combined with directbuffer detection for the best CPU performance plan
  5. A large number of clients continue to connect, disconnect, send messages, and troubleshoot memory leaks

TODO

  1. RTT stability test under high concurrent carbonization

Relevant information

  1. https://github.com/skywind3000/kcp The original ccp version of kcp
  2. https://github.com/xtaci/kcp-go go version kcp, with a lot of optimization
  3. https://github.com/Backblaze/JavaReedSolomon java version fec
  4. https://github.com/LMAX-Exchange/disruptor High-performance inter-thread messaging library
  5. https://github.com/JCTools/JCTools efficient concurrent library
  6. https://github.com/szhnet/kcp-netty A kcp for java version
  7. https://github.com/l42111996/csharp-kcp C# version of kcp based on dotNetty, perfectly compatible

communicate with

QQ: 526167774