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

epoll_wait的最后参数为什么是4MS ? #46

Open
yeyilihappy opened this issue Jun 12, 2018 · 1 comment
Open

epoll_wait的最后参数为什么是4MS ? #46

yeyilihappy opened this issue Jun 12, 2018 · 1 comment

Comments

@yeyilihappy
Copy link

如题,不应该通过计算定期或者超时事件最小触发时间而动态进行设置吗?
无就绪事件而有定时器来时,4ms会有延迟处理;
无就绪事件也无定时器来时,4MS触发的往下执行没有必要。

@unixliang
Copy link
Collaborator

#31 (comment)
可以参考这个comment。
无就绪事件的情况下,即使timeout参数填0,也会等待4ms左右,所以4ms是可填的最小的参数。
为什么timeout参数要填最小的?是因为随时有就绪的resp需要通过active_socket_func_回传给client,在吞吐低的时候,要通过EpollNotifier避免epoll_wait最长时长为timeout的卡顿;但吞吐的高低是有统计周期的,例如从高变低的过程中,EpollNotifier不能及时被触发,时长为timeout的卡顿还是会发生,所以timeout越小越好。

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