Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello,
in previous versions, I could run ZDNS with tens of thousands of threads without problem on a server with 64 logical cores. However, now it is impossible because of the added ulimit check that is too strict.
The default ulimit -n value for a newly created bash is 1024. When running zdns with 1000 threads, it now shows a warning:
with the calculated maximum connection count at 64,000 (supposedly 64 cores x 1000 threads)
However, the number of open sockets is 1001:
one socket open to get the local address:
zdns/pkg/zdns/zdns.go
Lines 200 to 206 in c8e1d8e
and 1000 sockets correspond to one socket open per goroutine. The total number of open files is less than 1024 and zdns should run without problem.
The problem IMO is coming from the maximum ulimit value:
zdns/pkg/zdns/zdns.go
Lines 217 to 222 in c8e1d8e
If I understand well GOMAXPROCS, it determines how many routines can run in parallel but it does not multiply the number of open sockets.
I propose to set the ulimit value to the number of threads as each thread is supposed to open one socket (reusable or not).