a performance issue for epoll idle
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 759
- Forks
- 277
- PR merge metrics
- No merged PRs in 30d
Description
I came across a performance issue in epoll mode, when there were thousands concurrent connections. Profiling shows that _st_epoll_dispatch() consumed a lot of CPU.
After reviewing the function, I think I've found the reason: there's a loop that enumerates ALL threads in the I/O queue.
for (q = _ST_IOQ.next; q != &_ST_IOQ; q = q->next) {
As I'm using one thread per connection model, I believe this loop make epoll mode degraded effectively to select mode.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at _st_epoll_dispatch() and inspect the _ST_IOQ traversal shown in the report. Reproduce the epoll workload with thousands of concurrent connections, profile its CPU use, and compare the result after addressing the reported traversal; done means the idle epoll path no longer shows the described degradation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, cpp
- Domain
- networking, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100