-
Notifications
You must be signed in to change notification settings - Fork 563
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
dns round-robin interceptor + cache #3350
Comments
this would need to implement Happy Eyeballs. |
This could be interesting, I was thinking about the same with the other closed issue but was unsure; if we are able to implement it with Happy Eyeballs will be really beneficial. It could be good to also pick-up different strategies for distributing the load, possibly weighted or based on response. |
I've put some hands on in this work, and I'm wondering what are your thoughts on several of these bits. First, the Interceptors by design cannot interfere with the connect semantics, but rather with the overall request's one. So for now, my initial idea is to:
My only concern is the async nature of the
|
We did it like this: https://github.com/nxtedition/nxt-undici/blob/main/lib/interceptor/dns.js Where our default lookup function is: function defaultLookup(origin, opts, callback) {
callback(null, Array.isArray(origin) ? origin[Math.floor(Math.random() * origin.length)] : origin)
} The DNS interceptor converts the origin to an array of possible origins and the lookup interceptor picks one if passed an array of origins. |
Ah, interesting; actually its not that far from what I'm currently doing 👍 Perfect, then it seems we are aligned, I'll also set the DNS settings in case no custom lookup is submitted and want to use default one. So far, I'm starting with a Round Robin one, and simple version of HappyEyeballs. I'm making the I'll open a PR maybe later Today 👍 |
The text was updated successfully, but these errors were encountered: