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

优化点 #134

Open
he3210 opened this issue Mar 1, 2022 · 0 comments
Open

优化点 #134

he3210 opened this issue Mar 1, 2022 · 0 comments

Comments

@he3210
Copy link

he3210 commented Mar 1, 2022

大佬,说的不对的话,请帮忙指出来

  1. http 读事件,不要把 EPOLLONESHOT 注册到 epoll 上。 每个 http 请求的处理都是单线程的,处理完每次 http 事件后,根据 old_event 和 new_event,比对一下(当前最新版本是没有对比的,都是 EPOLL_CTL_MOD,关于事件的二次注册这块目前写的感觉有点乱),来确定 EPOLL_CTL_MOD EPOLL_CTL_ADD EPOLL_CTL_DEL 或者不操作。这样能减少系统调用 epoll_ctl

  2. 小根堆定时器那里,我觉得最好使用 epoll_wait + 小根堆来实现,用小根堆的最小时间 timeout 来唤醒 epoll_wait,唤醒后,堆顶结点肯定超时了,libevent 就是这么做的

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

1 participant