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

Add DYNAMIC_ROUTER setting #6

Merged
merged 1 commit into from
Feb 14, 2017
Merged

Conversation

iksaif
Copy link

@iksaif iksaif commented Jan 26, 2017

The idea is that you want your consistent hashing ring to
adapt itself when destinations are down. This change will
remove destinations from the router when down and add them
back when up.

An additional buffer is created to store points when no
destination is up, the receiving socket is also paused in this
case to apply some back-pressure.

When a node is removed from the router its points are re-injected
to carbon to go through the new route.

@iksaif
Copy link
Author

iksaif commented Feb 6, 2017

Can I haz review ?

@erebe
Copy link

erebe commented Feb 6, 2017

looking

"""

def __init__(self):
self.queue = deque()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make it bounded, even if it is a big number.

log.clients("Destination is down: %s:%d:%s (%d/%d)" % (
destination[0], destination[1], destination[2], self.retries,
settings.DYNAMIC_ROUTER_MAX_RETRIES))
if self.retries < settings.DYNAMIC_ROUTER_MAX_RETRIES:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where do you increment retries ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ReconnectingClientFactory does that

The idea is that you want your consistent hashing ring to
adapt itself when destinations are down. This change will
remove destinations from the router when down and add them
back when up.

An additional buffer is created to store points when no
destination is up, the receiving socket is also paused in this
case to apply some back-pressure.

When a node is removed from the router its points are re-injected
to carbon to go through the new route.
Copy link
Author

@iksaif iksaif left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added comment in the code to explain why it looks like that

log.clients("Destination is down: %s:%d:%s (%d/%d)" % (
destination[0], destination[1], destination[2], self.retries,
settings.DYNAMIC_ROUTER_MAX_RETRIES))
if self.retries < settings.DYNAMIC_ROUTER_MAX_RETRIES:
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ReconnectingClientFactory does that

@erebe
Copy link

erebe commented Feb 7, 2017

👍

@iksaif
Copy link
Author

iksaif commented Feb 8, 2017

Will push early next week because it needs to be monitored closely

@iksaif iksaif merged commit 3ee1aff into criteo-forks:criteo-dev Feb 14, 2017
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

Successfully merging this pull request may close these issues.

4 participants