-
Notifications
You must be signed in to change notification settings - Fork 189
Improve relay selection to prioritize active reservations #972
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
base: main
Are you sure you want to change the base?
Improve relay selection to prioritize active reservations #972
Conversation
ca5b919 to
36f73ae
Compare
56414bf to
91b3d3b
Compare
|
Hi @parth-soni07 Thanks for tackling this issue. I really appreciate you diving into the relay selection logic. Overall this is a solid first pass and I like the direction you're taking. The test coverage is especially impressive 👏 I do have a few concerns I'd like you to address The self._relay_counter = 0
self._relay_counter_lock = trio.Lock()Then use it like: async with self._relay_counter_lock:
self._relay_counter += 1
index = (self._relay_counter - 1) % len(relays_with_reservations)Right now the counter increments every time we call Calling Could you mention the round-robin aspect more explicitly in the newsfragment? Something like: Implemented round-robin load balancing for CircuitV2 relay selection, prioritizing relays with active reservations for more reliable and evenly distributed relay usage.Again, really solid work here, the test suite especially shows you're thinking through the edge cases carefully. Once we address the thread safety and counter issues, this should be good to go. Well done @parth-soni07 keep it up with the good work |
|
Hi @parth-soni07, Thanks for working on this, I can see you are putting good effort into it. Round-robin distributes load evenly, but it doesn't actually help users get the best relay for their connection. A relay could be geographically far away, overloaded, or having network issues, and round-robin would still send traffic to it equally.
This would give us better user experience, natural load balancing, self-healing, and still prioritizes reserved relays when performance is similar I'm happy to pair with you on this if you need any help |
What was wrong?
Issue #735
How was it fixed?
Prioritizes first available relay with reservations instead of returning obvious first one.