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

Using tokio_threadpool::blocking for getaddrinfo #1570

Closed
srijs opened this issue Jun 14, 2018 · 3 comments
Closed

Using tokio_threadpool::blocking for getaddrinfo #1570

srijs opened this issue Jun 14, 2018 · 3 comments

Comments

@srijs
Copy link
Contributor

srijs commented Jun 14, 2018

I'm wondering how viable it would be to use tokio's blocking feature for dns lookups, removing the need to spawn a thread pool internally.

This could take the shape of something like HttpConnector::default which could be used by default in Client::new.

I know that blocking is used successfully in tokio-fs, but given that a DNS lookup tends to have a much higher worse-case latency, I'm unsure if this is a good idea.

Do you have any thoughts on it?

@sfackler
Copy link
Contributor

blocking will only work if you're running with the threadpool executor, (and not e.g. the current thread executor), so you'd need to be able to configure this. #1517 is related.

@seanmonstar
Copy link
Member

I have thought about it briefly, and as you mentioned, I worried about the generally much longer blocking of a DNS lookup vs reading a file that may be in cache.

However, as mentioned, this would prevent the connector from working with any other executor.

@seanmonstar
Copy link
Member

I'm going to close for now, since making HttpConnector require tokio-threadpool is not really possible. It should be possible to explore a separate connector that does what this issue describes, though!

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

No branches or pull requests

3 participants