openresty / openresty/lua-nginx-module
Use ngx_posted_delayed_events or ngx_posted_next_events to implement 0-delay timers
@zhuizhuhaomeng is already working on this.
Since Aug 10, 2020.
- Dominant language
- C
- Stars
- 11.8k
- Forks
- 2.1k
- Avg merge
- 6h 1m
- Merged PRs (30d)
- 6
Description
We currently use ngx_add_timer() to implement ngx.timer.at() timers with a 0 delay. This would lead to many invocations of epoll_wait or epoll_pwait syscalls when there are a lot of 0-delay timers created. Let's use the ngx_posted_delayed_events trick to run all the 0-delay timers created in the current event loop iteration in the next 0-timeout iteration.
It seems like newer nginx core has a similar mechanism without needing our openresty nginx patch, which is called ngx_posted_next_events. Let's switch everything over to this new thing for newer nginx core versions (including ngx.sleep and ngx.timer.at(0, ...).
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.
Assessment
This issue has not been assessed yet.