Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

服务器一次性发送10-20个包(小包),客户端接受出现严重延迟(1-2秒) #378

Open
NginxL opened this issue Nov 23, 2022 · 7 comments

Comments

@NginxL
Copy link

NginxL commented Nov 23, 2022

场景如下:
服务器先连续发送几十-几百个包。发送完毕后,客户端开始接受,就会出现严重的延迟。
请教下,这个可能是什么原因?

另外又测试了下,如果发送一次,接受一次,模拟echo,就没有这个问题。

@NginxL
Copy link
Author

NginxL commented Nov 23, 2022

补充下,是客户端会同时收到这几十个包,但是延迟很久2-3秒的 秒级延迟

@skywind3000
Copy link
Owner

增大窗口

@NginxL
Copy link
Author

NginxL commented Nov 23, 2022

发送10个小包,也会延迟个4秒。

@NginxL
Copy link
Author

NginxL commented Nov 23, 2022

增大窗口

另外,发送10个小包,也会延迟4秒,需要每次发送都flush吗,我是每隔10ms会update

@NginxL
Copy link
Author

NginxL commented Nov 23, 2022

增大窗口

底层的sendto一直都是能成功发送的,但是远端recvfrom 会一直返回没有数据可接受,过了一会才能收到所有数据。 随着发送的包越多,延迟越大。。

@skywind3000
Copy link
Owner

先检查你的 UDP 收发是否有问题,再看这里:

https://github.com/skywind3000/kcp/wiki/Flow-Control-for-Users

@NginxL
Copy link
Author

NginxL commented Nov 23, 2022

先检查你的 UDP 收发是否有问题,再看这里:

https://github.com/skywind3000/kcp/wiki/Flow-Control-for-Users

不好意思,之前log打印错了,又看了下,是ikcp_recv 一直返回-2,过了几秒才返回收到的所有包

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants