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

SOLR-15474 Make Circuit breakers pluggable (take 2) #1725

Merged
merged 5 commits into from
Aug 29, 2023

Conversation

janhoy
Copy link
Contributor

@janhoy janhoy commented Jun 27, 2023

https://issues.apache.org/jira/browse/SOLR-15474

This is a continuation of the effort from PR #193 which had grown out of date by almost 2 years and no activity.
Thus I updated that branch to main and squashed as one commit to kickstart this PR. I intend to bring it to mergable state.

To do before committable

  • Decide whether to move this to a cluster plugin instead of per core
  • Re-introduce support for <circuitBreaker class="solr.CircuitBreakerManager"> with all params for back compat
  • Update ref guide

@janhoy janhoy requested review from cpoerschke and atris June 27, 2023 13:27
@janhoy janhoy assigned madrob and unassigned madrob Jun 27, 2023
@janhoy janhoy requested a review from madrob June 27, 2023 13:27
Copy link
Contributor

@cpoerschke cpoerschke left a comment

Choose a reason for hiding this comment

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

Great to see this effort continue!

@janhoy
Copy link
Contributor Author

janhoy commented Aug 23, 2023

In the last commits I re-introduced backward compatibility for configuring the legacy "CircuitBreakerManager" as a single plugin. I did this by renaming CircuitBreakerManager as CircuitBreakerRegistry, so the registry is now in charge of knowing about all CBs, while the old Manager is now a true plugin, which wraps the cpu and mem CBs.

I'll probably not pursue converting to cluster-plugin in this PR since it will be a 10.0 only thing. But I want to achieve separating between update and query breakers.

Copy link
Contributor

@cpoerschke cpoerschke left a comment

Choose a reason for hiding this comment

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

16 / 18 files viewed -- only partly looked at the test changes so far.

And deprecating CircuitBreakerManager via morphing into a wrapper of two circuit breakers is a neat way to maintain backwards compatibility, very nice.

@janhoy
Copy link
Contributor Author

janhoy commented Aug 24, 2023

Thanks for reviewing @cpoerschke. Last bit of polish and then I hope to wrap up. Then this is a nice foundation to build /update circuit breaking on top of. I plan to let each CB plugin decide whether it should trip UPDATE, SEARCH or both request types. So you could e.g. have a CPU breaker on 80% for updates, and another one on 90% for search, letting you sacrifice freshness first and then user experience. But that is for another PR...

@janhoy
Copy link
Contributor Author

janhoy commented Aug 24, 2023

Will likely need to squash and force-push in order for Crave.io to do its job... Anyone have a problem with that?

Co-authored-by: Christine Poerschke <[email protected]>
Signed-off-by: Jan Høydahl <[email protected]>
@janhoy janhoy force-pushed the solr15474-pluggable-cb-take2 branch from 4050b9d to c6ef934 Compare August 24, 2023 13:54
@janhoy janhoy requested review from dsmiley and elyograg August 24, 2023 14:07
@janhoy
Copy link
Contributor Author

janhoy commented Aug 24, 2023

@dsmiley, @elyograg: I think this is ready, but appreciate if one of you would skim over this PR and see what you find.

@elyograg
Copy link
Contributor

@janhoy this deals with code where I have no knowledge. I wouldn't know how to tell whether the change is good or not.

@dsmiley
Copy link
Contributor

dsmiley commented Aug 24, 2023

My colleagues have done some custom Circuit Breaking stuff in Solr... I'm hoping one of them might weigh-in here so please don't merge too quickly.

@janhoy
Copy link
Contributor Author

janhoy commented Aug 25, 2023

My colleagues have done some custom Circuit Breaking stuff in Solr... I'm hoping one of them might weigh-in here so please don't merge too quickly.

This is not really touching the existing breaker logic itself, but the pluggability of them in solrconfig.xml.
There are other CB related issues as well you may want to weigh in to.

I'd also like to (in another issue) consider moving CB from core-level to node or cluster level and thus deprecate this solrconfig plugin altogether, but we need to stay back compat for now.

@dsmiley
Copy link
Contributor

dsmiley commented Aug 25, 2023

When you said "Then this is a nice foundation to build /update circuit breaking on top of.", I this caught my interest as this is what we're doing with Solr where I work. If this PR doesn't actually have to do with that, and is only about configuration, then merge away!

@janhoy
Copy link
Contributor Author

janhoy commented Aug 25, 2023

When you said "Then this is a nice foundation to build /update circuit breaking on top of.", I this caught my interest as this is what we're doing with Solr where I work. If this PR doesn't actually have to do with that, and is only about configuration, then merge away!

Sure, this is just making CBs pluggable for real, so you could create a DayOfWeekCB if you want :)

@janhoy
Copy link
Contributor Author

janhoy commented Aug 29, 2023

Looking for at least one "+1" before I proceed with the merge.

@atris
Copy link
Contributor

atris commented Aug 29, 2023

I took a look and it looks good to me.

Signed-off-by: Jan Høydahl <[email protected]>
@janhoy janhoy merged commit 4100049 into apache:main Aug 29, 2023
@janhoy janhoy deleted the solr15474-pluggable-cb-take2 branch August 29, 2023 10:47
Copy link
Contributor

@cpoerschke cpoerschke left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines +53 to 55
if (memEnabled) {
sb.append(memCB.getDebugInfo()).append("\n");
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if (memEnabled) {
sb.append(memCB.getDebugInfo()).append("\n");
}
if (memEnabled) {
sb.append(memCB.getDebugInfo());
}
if (memEnabled && cpuEnabled) {
sb.append("\n");
}

</query>

<circuitBreaker class="solr.MemoryCircuitBreaker">
<int name="threshold">75</int>
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
<int name="threshold">75</int>
<double name="threshold">75</double>

Comment on lines +242 to +245
List<CircuitBreaker> registeredCircuitBreakers =
h.getCore().getCircuitBreakerRegistry().getRegisteredCircuitBreakers();

registeredCircuitBreakers.clear();
Copy link
Contributor

Choose a reason for hiding this comment

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

Could deregisterAll be used here instead (and then getRegisteredCircuitBreakers() could be removed)?

Suggested change
List<CircuitBreaker> registeredCircuitBreakers =
h.getCore().getCircuitBreakerRegistry().getRegisteredCircuitBreakers();
registeredCircuitBreakers.clear();
h.getCore().getCircuitBreakerRegistry().deregisterAll();

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@cpoerschke Seems we had a race condition with your latest suggestions and my merge. Sorry for that, I could swear I saw some of those comments earlier, don't know how they got closed without merge.

I'll backport the initial commit. Would you mind filing a new PR with these latest changes? The commit message can reference same JIRA.

Copy link
Contributor

@cpoerschke cpoerschke Aug 29, 2023

Choose a reason for hiding this comment

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

No problem! #1870 for the follow-up bits. Would you mind including it in the back port?

edit: never mind, back port already happened. I can back port after merge.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That was my thought, probably easier to correlate later..

janhoy added a commit that referenced this pull request Aug 29, 2023
* SOLR-15474 Make Circuit breakers pluggable

Co-authored-by: Christine Poerschke <[email protected]>
Co-authored-by: Atri Sharma <[email protected]>
Signed-off-by: Jan Høydahl <[email protected]>

(cherry picked from commit 4100049)
Signed-off-by: Jan Høydahl <[email protected]>
justinrsweeney pushed a commit to cowpaths/fullstory-solr that referenced this pull request Nov 2, 2023
* SOLR-15474 Make Circuit breakers pluggable

Co-authored-by: Christine Poerschke <[email protected]>
Co-authored-by: Atri Sharma <[email protected]>
Signed-off-by: Jan Høydahl <[email protected]>

(cherry picked from commit 4100049)
Signed-off-by: Jan Høydahl <[email protected]>
justinrsweeney pushed a commit to cowpaths/fullstory-solr that referenced this pull request Apr 26, 2024
* SOLR-15474 Make Circuit breakers pluggable

Co-authored-by: Christine Poerschke <[email protected]>
Co-authored-by: Atri Sharma <[email protected]>
Signed-off-by: Jan Høydahl <[email protected]>

(cherry picked from commit 4100049)
Signed-off-by: Jan Høydahl <[email protected]>
nginthfs pushed a commit to cowpaths/fullstory-solr that referenced this pull request May 22, 2024
* SOLR-15474 Make Circuit breakers pluggable

Co-authored-by: Christine Poerschke <[email protected]>
Co-authored-by: Atri Sharma <[email protected]>
Signed-off-by: Jan Høydahl <[email protected]>

(cherry picked from commit 4100049)
Signed-off-by: Jan Høydahl <[email protected]>
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