Watch 12 Star 33 Fork 3

请叫我淼哥哥 / java-KcpJavaApache-2.0

Join us
Explore and code with more than 2 million developers,Free private repositories !:)
Sign up
基于java的netty实现的可靠udp网络库(kcp算法),包含fec实现,可用于游戏,视频,加速等业务 spread retract

Clone or download
Notice: Creating folder will generate an empty file .keep, because not support in Git



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.


  1. Compatible with c version of kcp
  2. fec implementation based on


  1. Based on disruptor 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. Increase unreliable udp sending and receiving in the same channel, and the game is more widely used

#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


  1. RTT stability test under high concurrent carbonization

#Relevant information

  1. The original ccp version of kcp
  2. go version kcp, with a lot of optimization
  3. java version fec
  4. High-performance inter-thread messaging library
  5. efficient concurrent library
  6. A kcp for java version

#communicate with

QQ: 526167774

Comments ( 0 )

Sign in for post a comment


Help Search