Skip to content

优化点 #134

Open
Open

Description

@he3210

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

  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 就是这么做的

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions