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

[apache/helix] -- Improve CI/CD Performance #2735

Conversation

himanshukandwal
Copy link
Contributor

@himanshukandwal himanshukandwal commented Jan 11, 2024

Issues

  • My PR addresses the following Helix issues and references them in the PR description:
    In this PR, we are addressing the overall helix CI/CD performance

Description

  • Here are some details about my PR, including screenshots of any UI changes:
    Changes to Boost performance include:

1. Using a standardized Helix ZK Client (TestHelper#createZkClient)
Allowed only one way to create ZK client and avoiding code duplication.

2. Removed un-necessary Thread.sleep
We removed constant time Thread.sleep statements especially after methods that add implicit wait and ensure sync completion. These include:

  • syncStop
  • syncStart
  • ZkHelixClusterVerifier.verifyByPolling()

3. Avoided adding all the BuiltInStateModelDefinitions
Allowed adding state-model defs on-demand bases during the cluster creation, depending on the resource type. This is an optimization that we are performing to selectively load only the state-model defs that are required for cluster. We have found that loading all state-model defs everytime in a cluster creation takes about 500-700ms, due to invocation of ZKUtil::isClusterSetup function that (repeatedly) ensure all the helix cluster paths are created before loading a state-model.

Improved Runtime: 1h 30m
Previous Runtime: 2h 10m

Tests

  • The following tests are written for this issue:
    N/A

  • The following is the result of the "mvn test" command on the appropriate module:

(If CI test fails due to known issue, please specify the issue and test PR locally. Then copy & paste the result of "mvn test" to here.)

Changes that Break Backward Compatibility (Optional)

  • My PR contains changes that break backward compatibility or previous assumptions for certain methods or API. They include:

(Consider including all behavior changes for public methods or API. Also include these changes in merge description so that other developers are aware of these changes. This allows them to make relevant code changes in feature branches accounting for the new method/API behavior.)

Documentation (Optional)

  • In case of new functionality, my PR adds documentation in the following wiki page:

(Link the GitHub wiki you added)

Commits

  • My commits all reference appropriate Apache Helix GitHub issues in their subject lines. In addition, my commits follow the guidelines from "How to write a good git commit message":
    1. Subject is separated from body by a blank line
    2. Subject is limited to 50 characters (not including Jira issue reference)
    3. Subject does not end with a period
    4. Subject uses the imperative mood ("add", not "adding")
    5. Body wraps at 72 characters
    6. Body explains "what" and "why", not "how"

Code Quality

  • My diff has been formatted using helix-style.xml
    (helix-style-intellij.xml if IntelliJ IDE is used)

Copy link
Contributor

@junkaixue junkaixue left a comment

Choose a reason for hiding this comment

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

First round review, will continue later.

Comment on lines +292 to +295
List<BuiltInStateModelDefinitions> stateModelDefinitions = Objects.isNull(stateModelDef)
? (resourceNb == 0 ? Collections.emptyList() : Arrays.asList(BuiltInStateModelDefinitions.values()))
: Arrays.asList(BuiltInStateModelDefinitions.valueOf(stateModelDef));
setupTool.addCluster(clusterName, stateModelDefinitions, false);
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here. I don't know why we would like to have tests on non existing state model?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, updated the reasoning with a comment as well along here. This is needed to avoid loading all the state-model defs and loading only the one which user has explicitly specified. Otherwise, we will load all.

@junkaixue
Copy link
Contributor

Ready for reviewing?

@junkaixue
Copy link
Contributor

@himanshukandwal

@himanshukandwal
Copy link
Contributor Author

Hey @junkaixue, this PR is ready to be reviewed.

Latest full CI successful run: https://github.com/himanshukandwal/helix/actions/runs/8277053505

for (int i = 0; i < (NODE_NR + 1) / 2; i++) {
_participants[i].syncStop();
Thread.sleep(2000);
Copy link
Contributor

Choose a reason for hiding this comment

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

Better not remove this, this wait time is for cluster converge. If you need to fix this, would be good to put a verifier here.

@@ -56,7 +56,7 @@ public void testSchemataSM() throws Exception {
1, // partitions per resource
n, // number of nodes
0, // replicas
"STORAGE_DEFAULT_SM_SCHEMATA", false); // don't rebalance
"MasterSlave", false); // don't rebalance
Copy link
Contributor

Choose a reason for hiding this comment

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

Use LeaderStandby instead of non-inclusive one.

@@ -101,7 +101,7 @@ public void testSchemataSM() throws Exception {
for (int i = 0; i < n; i++) {
String instanceName = "localhost_" + (12918 + i);
Assert.assertNotNull(stateMap.get(instanceName));
Assert.assertEquals(stateMap.get(instanceName), "MASTER");
Assert.assertEquals(stateMap.get(instanceName), i == 0 ? "MASTER" : "SLAVE");
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here. If you touch it, better change the model

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