?
based on LIBUV of the TCP Design (i)
based on LIBUV of the TCP Design (ii)
?
first, the second version of the libuv_tcp is already basic to use. No error and crashes, support hundreds of-way client connection simultaneously. However, there is a flaw that consumes Very high CPU. Because the idle phase detects that there is no data to send, idle idling when the server is idle , consumes CPU. Improvements have been made to this process today.
?
?
Second, improve
1. Remove the prepare,check,idle Event
2.prepare in the judge user off TCP and send data by Uv_async_send Replace
3. redefining the client data struct and the struct that sent the data
4. when the idle handle,write_t is collected, it is estimated that more than expected, long time does not recover, direct release.
5.Packet class is changed to Packetsync . Resolve the database package synchronously, enough to trigger a callback directly to the user. No longer uses another thread to resolve asynchronously.
?
——————————————————————————————————————————————————————————————————————
The code has been uploaded to git:? https://github.com/wqvbjhc/libuv_tcp
?
?
本文版权归作者和博客园共有,来源网址:http://www.cnblogs.com/wqvbjhc/
欢迎各位转载,但是未经作者本人同意,转载文章之后必须在文章页面明显位置给出作者和原文连接,否则保留追究法律责任的权利。
?
?
TCP design based on LIBUV (iii)