Skip to content

Add proposal document for ingester unregister flexibility #7231

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

Merged
merged 10 commits into from
Apr 25, 2024
Merged

Add proposal document for ingester unregister flexibility #7231

merged 10 commits into from
Apr 25, 2024

Conversation

LasseHels
Copy link
Contributor

@LasseHels LasseHels commented Jan 26, 2024

What this PR does

This pull request adds a document which summarises #5901 and introduces a solution proposal.

Checklist

  • Tests updated.
  • Documentation added.
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX].
  • about-versioning.md updated with experimental features.

@CLAassistant
Copy link

CLAassistant commented Jan 26, 2024

CLA assistant check
All committers have signed the CLA.

@LasseHels LasseHels marked this pull request as ready for review January 26, 2024 13:09
@LasseHels LasseHels requested review from a team as code owners January 26, 2024 13:09
@dimitarvdimitrov
Copy link
Contributor

thanks for taking the time to write this @LasseHels!

It makes sense to me in terms of allowing to trade of query consistency for availability. Mimir wasn't built with this use case in mind, so this solution seems a bit counter-intuitive. But if we make this clear in the documentation for anyone who uses it, it is an acceptable solution.

I've also asked other maintainers to take a look.

Copy link
Contributor

@pstibrany pstibrany left a comment

Choose a reason for hiding this comment

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

Thank you very much for writing the summary of the previous discussion in this short and digestible proposal. Suggested change looks tiny, and I would be curious to learn how it works in practice.

Have you tried to implement it and test if it works in your situation? If it works, I have no objections to adding such endpoint to Mimir.

**Cons**:
* Queries may return incomplete results as samples held by the evicted ingesters are temporarily inaccessible.
The samples become accessible again when the ingesters join the ring after having replayed their WAL.
* Ownership of evicted series (i.e., series whose owner was evicted) is split between two ingesters. This is likely
Copy link
Contributor

Choose a reason for hiding this comment

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

To confirm my understanding, this is a result of resharding, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is a result of resharding, right?

Yes. Consider this example:

  1. Ingester a-1 owns series up{app="database"}.
  2. a-1 ingests a couple of samples from series up{app="database"}.
  3. a-1 is evicted.
  4. As soon as a-1 is evicted, ownership of up{app="database"} is implicitly passed to a-5.
  5. While a-1 is restarting, a-5 ingests samples from the up{app="database"} series.
  6. Ownership of series up{app="database"} remains with a-5 even after a-1 has joined the ring once again1.
  7. Ownership of series up{app="database"} is now split since both a-1 and a-5 hold samples for the series.

Footnotes

  1. Unless tokens are persisted on disk via -ingester.ring.tokens-file-path, in which case ownership of the series will be passed back to a-1.

Copy link
Contributor

Choose a reason for hiding this comment

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

Right, thank you. I find this aspect of the proposal quite worrisome, to be honest, but whether it is a problem or not depends on your specifics.

(I will "unresolve" this conversation, as it has context that others may find useful.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@pstibrany Is there anything in particular with split series ownership that concerns you?

If my understanding is correct, split ownership can already happen if ingesters are configured (in the standard way) to leave the ring on shutdown. I suppose the endpoint makes it easier to trigger a state of split ownership.

Copy link
Collaborator

Choose a reason for hiding this comment

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

split ownership can already happen if ingesters are configured (in the standard way) to leave the ring on shutdown

That's correct. However, we don't recommend to leave ring on shutdown (e.g. we don't do it in our Jsonnet and Helm). The only reason why the default is still -ingester.ring.unregister-on-shutdown=true is because it's easier for the first time Mimir operator (at the beginning it's difficult to understand the implications of not leaving the ring on shutdown).

Copy link
Contributor

@pstibrany pstibrany Jan 29, 2024

Choose a reason for hiding this comment

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

@pstibrany Is there anything in particular with split series ownership that concerns you?

Resharding of the series and related increased usage of resources (memory, cpu) on other ingesters. If ingesters leave ring frequently, surviving ingesters may accumulate lot of series in memory that otherwise belong to other ingesters. It's something to keep in mind when planning for capacity. You save cost thanks to using spot-instances, but you may need to plan for larger instances instead. As you mention, it depends on how often ingester evictions happen.

@LasseHels
Copy link
Contributor Author

@pstibrany

Have you tried to implement it and test if it works in your situation?

We've not implemented it yet. We wanted to ensure that we had at least some buy-in from the Mimir team before starting with the implementation.

Copy link
Collaborator

@pracucci pracucci left a comment

Choose a reason for hiding this comment

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

With the maintainer hat

I agree with Peter that the proposed change looks small. I also think you don't need to get these changes in Mimir main to start testing it. Would be nice (but not a blocker) if you could just do the changes, deploy them in your cluster and share some data points about how it works for you.

Mimir is quite opininated about guaranteeing we never return partial query results. The only reason why this proposal doesn't break such stance is because the proposed API is generic and it's how it will get used that may cause partial query results (but it's no different than clicking the "Forget" button the ring page).

With the operator hat

I'm personally not much convinced about the approach you're going to take. I understand cutting costs, but I'm not sure doubting whether the query results you get are consistent or not may provide a bad query experience.

I also think that in case of a significant % of ingesters removed from the ring, the others will suffer a thundering effect that will cause an outage anyway. By experience, recovering from such outage may be tricky. If remaining ingesters ingested a volume of data they can't practically handle, the only way to recover is vertically scaling, because all data written to WAL will still be there in a subsequent restart (alternative is delete the WAL, which is quite bad).

That being said, these are my personal considerations on how you plan to use the API and not the API itself for which I have no concerns.

@LasseHels
Copy link
Contributor Author

@pstibrany @pracucci Thanks for your feedback. We will get started with an implementation and report back when we've tried it out, which could take a while.

@LasseHels LasseHels requested a review from jdbaldry as a code owner February 28, 2024 08:52
Copy link
Contributor

@jdbaldry jdbaldry left a comment

Choose a reason for hiding this comment

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

I'll leave this review for @grafana/mimir-maintainers and I've opened #7493 for the future.

@LasseHels
Copy link
Contributor Author

We will get started with an implementation and report back when we've tried it out, which could take a while.

See #5901 (comment).

@pstibrany Now that the parent pull request has been merged, should we merge this one also?

@pstibrany
Copy link
Contributor

@pstibrany Now that the parent pull request has been merged, should we merge this one also?

Let's do that.

@pstibrany pstibrany enabled auto-merge (squash) April 25, 2024 07:51
@LasseHels
Copy link
Contributor Author

Looks like a CI check is failing, let me see if I can fix that.

auto-merge was automatically disabled April 25, 2024 08:06

Head branch was pushed to by a user without write access

@LasseHels
Copy link
Contributor Author

Looks like a CI check is failing, let me see if I can fix that.

Fixed!

@pstibrany I think auto-merge was disabled because I pushed a new commit to fix the pipeline. We should be good to merge now.

@pstibrany pstibrany merged commit 00a2d1d into grafana:main Apr 25, 2024
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.

6 participants