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

Update mini_event.c #521

Merged
merged 1 commit into from Aug 12, 2021
Merged

Conversation

liheng562653799
Copy link
Contributor

@liheng562653799 liheng562653799 commented Aug 6, 2021

When in heavy load, unbound opens many outside_network sockets for out going queries to delegation servers, which may result in a big fd(maxfd) value(for thread A 1200, for thread B 1201, for thread C ...).
There are situations when thread A has a max fd num 1200 where maxfd is of course 1200, thread B has max fd num 20 for now but maxfd is still 1201. Though linux kernel checks whether maxfd+1 passed by select syscall is really the process' maxfd+1. Linux kernel can not tell maxfd+1 passed by thread B select syscall is much bigger(1201+1 or 1200+1 after trimed by kerne) than it should be (20+1).
In this situation, when kernel do_select() for thread B, much work is wasted.

When in heavy load, unbound opens many outside_network sockets for out going queries to delegation servers, which may result in a big fd(maxfd) value(for thread A 65500, for thread B 65501, for thread C ...). 
There are situations when thread A has a max fd num 65500 where maxfd is of course 65500, thread B has max fd num 20 for now but maxfd is still 65501. Though linux kernel checks whether maxfd+1  passed by select syscall  is really the process' maxfd+1. Linux kernel can not tell maxfd+1 passed by thread B select syscall is much bigger(65501+1 or 65500+1  after trimed by kerne) than it should be (20+1).
In this situation, when kernel do_select() for thread B, much work is wasted.
Copy link
Member

@wcawijngaards wcawijngaards left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to reduce the fd value when no longer high.

@wcawijngaards wcawijngaards merged commit 6780a08 into NLnetLabs:master Aug 12, 2021
wcawijngaards added a commit that referenced this pull request Aug 12, 2021
- Merge #521: Update mini_event.c.
@wcawijngaards
Copy link
Member

Thank you for the patch. That would help keep the maxfd lower value.

jedisct1 added a commit to jedisct1/unbound that referenced this pull request Aug 12, 2021
* nlnet/master: (37 commits)
  - Fix to print error from unbound-anchor for writing to the key   file, also when not verbose.
  - For NLnetLabs#519: fix comments for doxygen.
  - For NLnetLabs#519: yacc and lex. And fix python bindings, and test program   unbound-dnstap-socket.
  Changelog note for NLnetLabs#519 and example.conf edit - Merge NLnetLabs#519: Support for selective enabling tcp-upstream for   stub/forward zones. - For NLnetLabs#519: note stub-tcp-upstream and forward-tcp-upstream in   the example configuration file.
  Changelog note for NLnetLabs#523 - Merge NLnetLabs#523: fix: free() call more than once with the same pointer.
  Changelog note for NLnetLabs#521 - Merge NLnetLabs#521: Update mini_event.c.
  - Add test tool readzone to .gitignore.
  - And 1.13.2rc1 became the 1.13.2 with the fix for the python module   build. The current code repository continues with version 1.13.3.
  fix: free() call more than once with the same pointer
  Update mini_event.c
  - Fix NLnetLabs#520: Unbound 1.13.2rc1 fails to build python module.
  Add (stub|forward)-tcp-upstream options which enable using tcp transport only for specified stub/forward zones
  For 1.13.2rc1.
  - Tag for 1.13.2 release.
  - Fix unit test zonemd_reload for use in run_vm.
  - Fix libnettle zonemd unit test.
  - Fix out of sourcedir run of zonemd unit tests.
  - Fix readzone compile under debug config.
  - Fix missing locks in zonemd unit test.
  - Fix static analysis warnings about localzone locks that are unused.
  ...
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

Successfully merging this pull request may close these issues.

None yet

2 participants