From 44b8e44cf295f133af1e0cfbc164c3147a267ae9 Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Tue, 23 Jul 2024 22:31:07 +1200 Subject: [PATCH] Tidy up documentation. --- guides/getting-started/readme.md | 64 ++------------------------------ lib/async/dns/resolver.rb | 2 +- 2 files changed, 5 insertions(+), 61 deletions(-) diff --git a/guides/getting-started/readme.md b/guides/getting-started/readme.md index 01aa8a3..2dcd65c 100644 --- a/guides/getting-started/readme.md +++ b/guides/getting-started/readme.md @@ -17,14 +17,10 @@ $ bundle add async-dns Here is a simple example showing how to use the resolver: ``` ruby -Async do - resolver = Async::DNS::System.resolver - - addresses = resolver.addresses_for("www.google.com.") - - puts addresses.inspect -end -# [#, #, #, #, #, #, #, #, #, #, #, #, #, #, #, #] +resolver = Async::DNS::System.resolver + +resolver.addresses_for("www.google.com.") +# => [#, #] ``` ### Server @@ -54,55 +50,3 @@ server.run Then to test you could use `dig` like so: dig @localhost -p 5300 google.com - -## FAQ - -### File Handle Limitations - -I get the error `Errno::EMFILE: Too many open files - socket(2) - udp` when trying to run a server. What should I do? - -On some platforms (e.g. Mac OS X) the number of file descriptors is relatively low by default and should be increased by calling `ulimit -n 10000` before running tests or even before starting a server which expects a large number of concurrent incoming connections. - -### Server - -The performance is on the same magnitude as `bind9`. Some basic benchmarks resolving 1000 names concurrently, repeated 5 times, using `Async::DNS::Resolver` gives the following: - -``` - user system total real -Async::DNS::Server 4.280000 0.450000 4.730000 ( 4.854862) -Bind9 4.970000 0.520000 5.490000 ( 5.541213) -``` - -These benchmarks are included in the unit tests. To test bind9 performance, it must be installed and `which named` must return the executable. - -## Performance - -We welcome additional benchmarks and feedback regarding Async::DNS performance. To check the current performance results, consult the [travis build job output](https://travis-ci.org/socketry/async-dns). - -### Resolver - -The `Async::DNS::Resolver` is highly concurrent and can resolve individual names as fast as the built in `Resolv::DNS` resolver. Because the resolver is asynchronous, when dealing with multiple names, it can work more efficiently: - -``` - user system total real -Async::DNS::Resolver 0.020000 0.010000 0.030000 ( 0.030507) -Resolv::DNS 0.070000 0.010000 0.080000 ( 1.465975) -``` - -These benchmarks are included in the unit tests. - -### Server - -The performance is on the same magnitude as `bind9`. Some basic benchmarks resolving 1000 names concurrently, repeated 5 times, using `Async::DNS::Resolver` gives the following: - -``` - user system total real -Async::DNS::Server 4.280000 0.450000 4.730000 ( 4.854862) -Bind9 4.970000 0.520000 5.490000 ( 5.541213) -``` - -These benchmarks are included in the unit tests. To test bind9 performance, it must be installed and `which named` must return the executable. - -### DNSSEC support - -DNSSEC is currently not supported and is [unlikely to be supported in the future](http://sockpuppet.org/blog/2015/01/15/against-dnssec/). Feel free to submit a PR. \ No newline at end of file diff --git a/lib/async/dns/resolver.rb b/lib/async/dns/resolver.rb index 78271ea..737aa50 100644 --- a/lib/async/dns/resolver.rb +++ b/lib/async/dns/resolver.rb @@ -185,7 +185,7 @@ def dispatch_query(name, resource_class) end # Send the message to available servers. If no servers respond correctly, nil is returned. This result indicates a failure of the resolver to correctly contact any server and get a valid response. - def dispatch_request(message, parent: Async::Task.current) + def dispatch_request(message) request = Request.new(message, @endpoint) error = nil