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-17106: LBSolrClient - Make zombie ping checks configurable #2160

Closed
wants to merge 7 commits into from

Conversation

aparnasuresh85
Copy link
Contributor

@aparnasuresh85 aparnasuresh85 commented Dec 18, 2023

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

Description

Please provide a short description of the changes you're making with this pull request.
The issue involves scalability challenges in SolrJ's LBSolrClient when a pod with numerous cores experiences connectivity problems. The "zombie" ping checking mechanism, operating on a core basis, becomes a bottleneck during distributed search on a massive multi shard collection. Threads attempting to reach unhealthy cores contribute to a high computational load, causing performance issues.

LBSolrClient could be configured to disable zombie "ping" checks, but retain zombie tracking. Once a replica/endpoint is identified as a zombie, it could be held in zombie state for X seconds, before being released - hoping that by this timeframe ZK would be updated to mark this endpoint DOWN or the pod is back up and CloudSolrClient would avoid querying it. In any event, only 1 failed query would be needed to send the server back to zombie state.

Dev list thread: https://lists.apache.org/thread/f0zfmpg0t48xrtppyfsmfc5ltzsq2qqh

Solution

Please provide a short description of the approach taken to implement your solution.

Modified the code to make zombie ping checking configurable through a new property named "enableZombiePingChecks." When set to true, the system is designed to periodically send zombie ping requests every zombiePingIntervalMillis. Conversely, setting it to false disables zombie pings and instead monitors the "zombieServers" every zombieStateMonitoringIntervalMillis. This monitoring identifies replicas or endpoints that have spent at least minZombieReleaseTimeMillis as zombies, subsequently releasing them from the zombie state and adding them back to the alive set.

The default configuration for zombiePingIntervalMillis remains at 1 minute, while zombieStateMonitoringIntervalMillis is currently set to 5 seconds, and minZombieReleaseTimeMillis is configured at 10 seconds.

Corresponding tests in TestLBHttp2SolrClient and TestLBHttpSolrClient have been adjusted accordingly.

Tests

Please describe the tests you've developed or run to confirm this patch implements the feature or solves the problem.
Slight refactoring in TestLBHttp2SolrClient and TestLBHttpSolrClient, added a new test testReliabilityWithoutZombiePingChecks in TestLBHttp2SolrClient. All tests pass.

Checklist

Please review the following and check all that apply:

  • I have reviewed the guidelines for How to Contribute and my code conforms to the standards described there to the best of my ability.
  • I have created a Jira issue and added the issue ID to my pull request title.
  • I have given Solr maintainers access to contribute to my PR branch. (optional but recommended)
  • I have developed this patch against the main branch.
  • I have run ./gradlew check.
  • I have added tests for my changes.
  • I have added documentation for the Reference Guide

@aparnasuresh85 aparnasuresh85 marked this pull request as ready for review December 20, 2023 20:37
…gure the liveness checker to only inspect a URL ever N runs
@github-actions github-actions bot added the tests label Mar 14, 2024
Copy link

This PR had no visible activity in the past 60 days, labeling it as stale. Any new activity will remove the stale label. To attract more reviewers, please tag someone or notify the [email protected] mailing list. Thank you for your contribution!

@github-actions github-actions bot added the stale PR not updated in 60 days label May 15, 2024
@dsmiley
Copy link
Contributor

dsmiley commented May 15, 2024

Aparna, are we just missing use of EnvUtils here? I know we've taken this change as-is (in our fork) but even we don't have that, thus it's hard to actually use the changes configured here.

Copy link
Contributor

@epugh epugh left a comment

Choose a reason for hiding this comment

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

We need to update the merge conflicts, review some of the formatting etc. And lastly, to use the right method of looking up settings. I think @dsmiley has already approved the direction, which makes me more comfortable about merging it.

* Positive values can be used to ensure that the liveness checks for a given URL will only be
* run every "Nth" iteration of the setAliveCheckInterval
*
* @param aliveCheckSkipIters, number of iterations to skip, an int value *
Copy link
Contributor

Choose a reason for hiding this comment

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

did this mean to have a trailing *?

public LBHttp2SolrClient.Builder setAliveCheckSkipIters(int aliveCheckSkipIters) {
if (aliveCheckSkipIters < 0) {
throw new IllegalArgumentException(
("Alive Check Skip Iterations must be positive, specified value = "
Copy link
Contributor

Choose a reason for hiding this comment

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

do we need the doubled ( here? Maybe for string parsing?

/**
* Positive values can be used to ensure that the liveness checks for a given URL will only be
* run every "Nth" iteration of the setAliveCheckInterval
* @param aliveCheckSkipIters, number of iterations to skip, an int value *
Copy link
Contributor

Choose a reason for hiding this comment

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

again the trailing *

public Builder setAliveCheckSkipIters(int aliveCheckSkipIters) {
if (aliveCheckSkipIters < 0) {
throw new IllegalArgumentException(
("Alive Check Skip Iterations must be positive, specified value = "
Copy link
Contributor

Choose a reason for hiding this comment

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

and the doubled (

@@ -79,24 +81,27 @@ public abstract class LBSolrClient extends SolrClient {

protected long aliveCheckIntervalMillis =
TimeUnit.MILLISECONDS.convert(60, TimeUnit.SECONDS); // 1 minute between checks
protected int aliveCheckSkipIters = 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we use the short hand Iters in lots of places? If not, I like the full Iteration as just one less thing to read.

Copy link
Contributor

Choose a reason for hiding this comment

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

maybe just a personal thing though.

log.debug("Assuming success because aliveCheckQuery is null");
return true;
}
log.debug("Running ping check on server " + zombieServer.getBaseUrl());
Copy link
Contributor

Choose a reason for hiding this comment

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

likewise on the check?

}
// push back on liveness checks only every Nth iteration
if (zombieServer.skipAliveCheckIters > 0) {
log.debug(
Copy link
Contributor

Choose a reason for hiding this comment

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

the ifDebugEnabled check

if (!zombieServer.standard && zombieServer.failedPings >= NONSTANDARD_PING_LIMIT) {
zombieServers.remove(zombieServer.getBaseUrl());
if (isServerAlive(zombieServer)) {
log.debug("Successfully pinged server " + zombieServer.getBaseUrl() + ", marking it alive");
Copy link
Contributor

Choose a reason for hiding this comment

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

and the check

Copy link
Contributor

Choose a reason for hiding this comment

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

Always use "{}" templates in SLF4J

}

} catch (Exception e) {
log.debug(
Copy link
Contributor

Choose a reason for hiding this comment

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

and the check! I think the whole check thing is werid that it's not just part of log.debug!

@@ -205,16 +202,31 @@ public void testTwoServers() throws Exception {
}
}

public void testReliability() throws Exception {
@LogLevel("org.apache.solr.client.solrj.impl.LBSolrClient=DEBUG")
Copy link
Contributor

Choose a reason for hiding this comment

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

is this needed to make the test pass, or from working on the code? the @loglevel?

Copy link
Contributor

Choose a reason for hiding this comment

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

ah, I think I see why you have it from looking lower down in the LogReliablityTestSetup

@github-actions github-actions bot removed the stale PR not updated in 60 days label May 22, 2024
Copy link

This PR has had no activity for 60 days and is now labeled as stale. Any new activity or converting it to draft will remove the stale label. To attract more reviewers, please tag people who might be familiar with the code area and/or notify the [email protected] mailing list. Thank you for your contribution!

@github-actions github-actions bot added the stale PR not updated in 60 days label Jul 23, 2024
Copy link

github-actions bot commented Oct 8, 2024

This PR is now closed due to 60 days of inactivity after being marked as stale. Re-opening this PR is still possible, in which case it will be marked as active again.

@github-actions github-actions bot added the closed-stale Closed after being stale for 60 days label Oct 8, 2024
@github-actions github-actions bot closed this Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client:solrj closed-stale Closed after being stale for 60 days stale PR not updated in 60 days tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants