-
Notifications
You must be signed in to change notification settings - Fork 276
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: Don't iterate all the fds when using epoll #5
base: master
Are you sure you want to change the base?
Conversation
Please merge it |
|
I have merge this PR to https://github.com/ossrs/state-threads/tree/features/xiaosuo/epoll |
重新看了ST的调度和IO事件处理的代码,看懂了你说的问题在哪里,以及主要优化的场景,我记录在了这里:#13 (comment) ST在收到事件后,会遍历io_q,因为st对于fd的记录只记录了events,而没有记录哪些协程(_st_pollq_t)在侦听这个fd,因为一个协程可能会用 如果FD很多时,有大量等待IO的fd时,就会触发这个性能瓶颈,可以看到 由于这个修改涉及较多,我觉得还是应该先完善ST的UTest,然后再修改这个问题。
|
_st_pollq_t *pq; | ||
_st_pollq_t **pqs; | ||
}; | ||
int pq_cnt; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_st_epolldata. evtlist.epoll_data.ptr是可以放自定义指针的。
可能更适合放_st_pollq_t的信息,可以存放协程的链表_st_clist_t。
typedef union epoll_data {
void *ptr;
int fd;
uint32_t u32;
uint64_t u64;
} epoll_data_t;
struct epoll_event {
uint32_t events; /* Epoll events */
epoll_data_t data; /* User data variable */
};
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#[[[[[**_```
> ~~~~~~~~``~~committed ~~``~~~~~~~~
For #4