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

Improve Retry Logic #61

Closed
kcajmagic opened this issue May 1, 2019 · 5 comments · Fixed by xmidt-org/svalinn#86
Closed

Improve Retry Logic #61

kcajmagic opened this issue May 1, 2019 · 5 comments · Fixed by xmidt-org/svalinn#86
Assignees
Labels
enhancement New feature or request

Comments

@kcajmagic
Copy link
Member

Currently, when an insert fails with n number of records. The exact same query will be rejected.

To improve upon this I recommend having a retry channel where records get added upon to try again in a batch and as a last result do an insert one record at a time.

@kcajmagic kcajmagic added the enhancement New feature or request label May 1, 2019
@kristinapathak
Copy link
Contributor

kristinapathak commented May 1, 2019

Currently, we can retry n number of times. Per my understanding, this change would mean only being able to retry each record twice. This seems less flexible, but I do agree if there's a problem with one record in a batch it will eventually force us to drop all records in that batch.

Implementation suggestions:

  • when we put a record into a retry channel, wrap it in a struct with the number of times it has been retried, so the retry workers can check and reject records as they find ones past the acceptable number of retries
  • make the retry batch smaller, so instead of ultimately dropping 50 records maybe we drop 5.

I'm also worried individual/smaller batches of inserts after a failure will greatly slow down the database at a time when it may already be under load which is causing the failures.

@kcajmagic
Copy link
Member Author

I like the idea of wrapping the object in an envelope to limit how many times a record can be retried.

I feel like the potential slow down is a necessary evil to have a higher success rate of getting events into the database.

@kristinapathak
Copy link
Contributor

I'm good with some slowdown (with the retry batch size is a configurable value), but I don't think the last attempt should be inserting one record at a time. This could also make it harder and take longer to recover from an issue.

@kristinapathak
Copy link
Contributor

This would involve moving batchInserter logic from svalinn into the database, combining the retryer and the batcher.

@kristinapathak
Copy link
Contributor

After further discussion, we agreed on making the time to wait between retries exponential and to move the batchInserter from svalinn to codex. The retryer and batchInserter are still separate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants