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

Add support for wrapping CollectorManager with profiling during concurrent execution #9129

Merged
merged 2 commits into from
Aug 15, 2023

Conversation

ticheng-aws
Copy link
Contributor

@ticheng-aws ticheng-aws commented Aug 5, 2023

Description

In the multi-level aggregation profile with concurrent execution, the response’s collectors miss profiling aggregator information. This happens because the AggCollectorManager is not wrapped by the InternalProfileCollectorManager when the profile is enabled and concurrent execution takes place. To resolve the issue, we need to wrap all the sub-collectorManagers with the InternalProfileCollectorManager.

Example of a valid profile response with concurrent search enabled:

{
    ...
    "profile":
    {
        "shards":
        [
            {
                "id": "[3Z04lnEDTq6XiPVosv-tgA][index][0]",
                "inbound_network_time_in_millis": 0,
                "outbound_network_time_in_millis": 0,
                "searches":
                [
                    {
                        "query": [...],
                        "rewrite_time": 11001,
                        "collector":
                        [
                            {
                                "name": "QueryCollectorManager",
                                "reason": "search_multi",
                                "time_in_nanos": 3238624,
                                "reduce_time_in_nanos": 3601167,
                                "max_slice_time_in_nanos": 2177665,
                                "min_slice_time_in_nanos": 342251,
                                "avg_slice_time_in_nanos": 1712583,
                                "slice_count": 5,
                                "children":
                                [
                                    {
                                        "name": "SimpleTopDocsCollectorManager",
                                        "reason": "search_top_hits",
                                        "time_in_nanos": 1538416,
                                        "reduce_time_in_nanos": 684458,
                                        "max_slice_time_in_nanos": 326084,
                                        "min_slice_time_in_nanos": 184292,
                                        "avg_slice_time_in_nanos": 265216,
                                        "slice_count": 5
                                    },
                                    {
                                        "name": "NonGlobalAggCollectorManager: [histo]",
                                        "reason": "aggregation",
                                        "time_in_nanos": 2255000,
                                        "reduce_time_in_nanos": 2838750,
                                        "max_slice_time_in_nanos": 1045209,
                                        "min_slice_time_in_nanos": 152250,
                                        "avg_slice_time_in_nanos": 826808,
                                        "slice_count": 5
                                    }
                                ]
                            }
                        ]
                    },
                    {
                        "query": [...],
                        "rewrite_time": 2833,
                        "collector":
                        [
                            {
                                "name": "GlobalAggCollectorManager: [global]",
                                "reason": "aggregation_global",
                                "time_in_nanos": 657625,
                                "reduce_time_in_nanos": 399416,
                                "max_slice_time_in_nanos": 503000,
                                "min_slice_time_in_nanos": 28999,
                                "avg_slice_time_in_nanos": 217357,
                                "slice_count": 5
                            }
                        ]
                    }
                ],
                "aggregations": [...]
            }
        ]
    }
}

Related Issues

Resolves #8332 #7354

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed per the DCO using --signoff
  • Commit changes are listed out in CHANGELOG.md file (See: Changelog)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@ticheng-aws ticheng-aws changed the title Add support for CollectorManager wrapping with profiling with concurrent execution Add support for wrapping CollectorManager with profiling during concurrent execution Aug 5, 2023
@opensearch-trigger-bot
Copy link
Contributor

Compatibility status:



> Task :checkCompatibility
Incompatible components: [https://github.com/opensearch-project/geospatial.git, https://github.com/opensearch-project/index-management.git, https://github.com/opensearch-project/security-analytics.git, https://github.com/opensearch-project/alerting.git, https://github.com/opensearch-project/anomaly-detection.git, https://github.com/opensearch-project/asynchronous-search.git, https://github.com/opensearch-project/cross-cluster-replication.git, https://github.com/opensearch-project/performance-analyzer.git]
Compatible components: [https://github.com/opensearch-project/security.git, https://github.com/opensearch-project/notifications.git, https://github.com/opensearch-project/neural-search.git, https://github.com/opensearch-project/sql.git, https://github.com/opensearch-project/job-scheduler.git, https://github.com/opensearch-project/opensearch-oci-object-storage.git, https://github.com/opensearch-project/observability.git, https://github.com/opensearch-project/k-nn.git, https://github.com/opensearch-project/common-utils.git, https://github.com/opensearch-project/reporting.git, https://github.com/opensearch-project/ml-commons.git, https://github.com/opensearch-project/performance-analyzer-rca.git]

BUILD SUCCESSFUL in 28m 40s

@opensearch-trigger-bot
Copy link
Contributor

Compatibility status:



> Task :checkCompatibility
Incompatible components: [https://github.com/opensearch-project/alerting.git, https://github.com/opensearch-project/anomaly-detection.git, https://github.com/opensearch-project/asynchronous-search.git, https://github.com/opensearch-project/index-management.git, https://github.com/opensearch-project/geospatial.git, https://github.com/opensearch-project/cross-cluster-replication.git, https://github.com/opensearch-project/security-analytics.git, https://github.com/opensearch-project/performance-analyzer.git]
Compatible components: [https://github.com/opensearch-project/security.git, https://github.com/opensearch-project/common-utils.git, https://github.com/opensearch-project/sql.git, https://github.com/opensearch-project/reporting.git, https://github.com/opensearch-project/job-scheduler.git, https://github.com/opensearch-project/observability.git, https://github.com/opensearch-project/notifications.git, https://github.com/opensearch-project/k-nn.git, https://github.com/opensearch-project/neural-search.git, https://github.com/opensearch-project/ml-commons.git, https://github.com/opensearch-project/opensearch-oci-object-storage.git, https://github.com/opensearch-project/performance-analyzer-rca.git]

BUILD SUCCESSFUL in 28m 57s

@github-actions
Copy link
Contributor

github-actions bot commented Aug 5, 2023

Gradle Check (Jenkins) Run Completed with:

@codecov
Copy link

codecov bot commented Aug 5, 2023

Codecov Report

Merging #9129 (11b24c3) into main (4114009) will decrease coverage by 0.11%.
Report is 1 commits behind head on main.
The diff coverage is 40.42%.

@@             Coverage Diff              @@
##               main    #9129      +/-   ##
============================================
- Coverage     71.19%   71.08%   -0.11%     
+ Complexity    57455    57390      -65     
============================================
  Files          4777     4777              
  Lines        270712   270747      +35     
  Branches      39566    39569       +3     
============================================
- Hits         192729   192458     -271     
- Misses        61782    62089     +307     
+ Partials      16201    16200       -1     
Files Changed Coverage Δ
...arch/aggregations/DefaultAggregationProcessor.java 13.04% <0.00%> (-0.92%) ⬇️
...opensearch/search/query/QueryCollectorContext.java 62.33% <0.00%> (-19.02%) ⬇️
.../GlobalAggCollectorManagerWithSingleCollector.java 66.66% <50.00%> (-4.77%) ⬇️
...rch/aggregations/NonGlobalAggCollectorManager.java 91.66% <50.00%> (-8.34%) ⬇️
...nGlobalAggCollectorManagerWithSingleCollector.java 66.66% <50.00%> (-4.77%) ⬇️
...arch/aggregations/AggregationCollectorManager.java 88.00% <100.00%> (+10.22%) ⬆️
...h/aggregations/ConcurrentAggregationProcessor.java 87.87% <100.00%> (+6.62%) ⬆️
...search/aggregations/GlobalAggCollectorManager.java 100.00% <100.00%> (ø)
...profile/query/InternalProfileCollectorManager.java 96.82% <100.00%> (+0.39%) ⬆️

... and 465 files with indirect coverage changes

@github-actions
Copy link
Contributor

github-actions bot commented Aug 5, 2023

Gradle Check (Jenkins) Run Completed with:

ticheng-aws added a commit to ticheng-aws/OpenSearch that referenced this pull request Aug 14, 2023
@ticheng-aws ticheng-aws requested a review from reta August 14, 2023 16:18
@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

  • RESULT:
  • URL:
  • CommitID: 7536cfc
    Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green.
    Is the failure a flaky test unrelated to your change?

ticheng-aws added a commit to ticheng-aws/OpenSearch that referenced this pull request Aug 14, 2023
ticheng-aws added a commit to ticheng-aws/OpenSearch that referenced this pull request Aug 14, 2023
@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

  • RESULT: UNSTABLE ❕
  • TEST FAILURES:
      2 org.opensearch.common.util.concurrent.QueueResizableOpenSearchThreadPoolExecutorTests.classMethod
      1 org.opensearch.common.util.concurrent.QueueResizableOpenSearchThreadPoolExecutorTests.testResizeQueueDown

@opensearch-trigger-bot
Copy link
Contributor

Compatibility status:



> Task :checkCompatibility
Incompatible components: [https://github.com/opensearch-project/alerting.git, https://github.com/opensearch-project/index-management.git, https://github.com/opensearch-project/asynchronous-search.git, https://github.com/opensearch-project/common-utils.git, https://github.com/opensearch-project/cross-cluster-replication.git, https://github.com/opensearch-project/notifications.git, https://github.com/opensearch-project/security-analytics.git]
Compatible components: [https://github.com/opensearch-project/security.git, https://github.com/opensearch-project/anomaly-detection.git, https://github.com/opensearch-project/sql.git, https://github.com/opensearch-project/job-scheduler.git, https://github.com/opensearch-project/observability.git, https://github.com/opensearch-project/reporting.git, https://github.com/opensearch-project/k-nn.git, https://github.com/opensearch-project/geospatial.git, https://github.com/opensearch-project/neural-search.git, https://github.com/opensearch-project/ml-commons.git, https://github.com/opensearch-project/performance-analyzer.git, https://github.com/opensearch-project/performance-analyzer-rca.git, https://github.com/opensearch-project/opensearch-oci-object-storage.git]

BUILD SUCCESSFUL in 33m 18s

@opensearch-trigger-bot
Copy link
Contributor

Compatibility status:

Checks if related components are compatible with change 0a7eade

Incompatible components

Incompatible components: [https://github.com/opensearch-project/alerting.git, https://github.com/opensearch-project/index-management.git, https://github.com/opensearch-project/asynchronous-search.git, https://github.com/opensearch-project/cross-cluster-replication.git, https://github.com/opensearch-project/notifications.git, https://github.com/opensearch-project/security-analytics.git]

Skipped components

Compatible components

Compatible components: [https://github.com/opensearch-project/security.git, https://github.com/opensearch-project/anomaly-detection.git, https://github.com/opensearch-project/sql.git, https://github.com/opensearch-project/common-utils.git, https://github.com/opensearch-project/job-scheduler.git, https://github.com/opensearch-project/observability.git, https://github.com/opensearch-project/reporting.git, https://github.com/opensearch-project/k-nn.git, https://github.com/opensearch-project/geospatial.git, https://github.com/opensearch-project/ml-commons.git, https://github.com/opensearch-project/neural-search.git, https://github.com/opensearch-project/performance-analyzer.git, https://github.com/opensearch-project/performance-analyzer-rca.git, https://github.com/opensearch-project/opensearch-oci-object-storage.git]

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@reta reta merged commit 152321b into opensearch-project:main Aug 15, 2023
10 of 11 checks passed
@sohami sohami added the backport 2.x Backport to 2.x branch label Aug 15, 2023
@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.x failed:

The process '/usr/bin/git' failed with exit code 128

To backport manually, run these commands in your terminal:

# Navigate to the root of your repository
cd $(git rev-parse --show-toplevel)
# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/OpenSearch/backport-2.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/OpenSearch/backport-2.x
# Create a new branch
git switch --create backport/backport-9129-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 152321b3adaa06199d741472baca964f90aff068
# Push it to GitHub
git push --set-upstream origin backport/backport-9129-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/OpenSearch/backport-2.x

Then, create a pull request where the base branch is 2.x and the compare/head branch is backport/backport-9129-to-2.x.

ticheng-aws added a commit to ticheng-aws/OpenSearch that referenced this pull request Aug 15, 2023
…rrent execution (opensearch-project#9129)

* Add support for wrapping CollectorManager with profiling during concurrent execution (opensearch-project#9129)

Signed-off-by: Ticheng Lin <[email protected]>

* Add more collectorResult test and work on the PR comments (opensearch-project#9129)

Signed-off-by: Ticheng Lin <[email protected]>

---------

Signed-off-by: Ticheng Lin <[email protected]>
ticheng-aws added a commit to ticheng-aws/OpenSearch that referenced this pull request Aug 15, 2023
…rrent execution (opensearch-project#9129)

* Add support for wrapping CollectorManager with profiling during concurrent execution (opensearch-project#9129)

Signed-off-by: Ticheng Lin <[email protected]>

* Add more collectorResult test and work on the PR comments (opensearch-project#9129)

Signed-off-by: Ticheng Lin <[email protected]>

---------

Signed-off-by: Ticheng Lin <[email protected]>
reta added a commit that referenced this pull request Aug 16, 2023
…rrent execution (#9129) (#9373)

* Add support for wrapping CollectorManager with profiling during concurrent execution (#9129)



* Add more collectorResult test and work on the PR comments (#9129)



---------

Signed-off-by: Ticheng Lin <[email protected]>
Signed-off-by: Andriy Redko <[email protected]>
Co-authored-by: Andriy Redko <[email protected]>
kkmr pushed a commit to kkmr/OpenSearch that referenced this pull request Aug 28, 2023
…rrent execution (opensearch-project#9129)

* Add support for wrapping CollectorManager with profiling during concurrent execution (opensearch-project#9129)

Signed-off-by: Ticheng Lin <[email protected]>

* Add more collectorResult test and work on the PR comments (opensearch-project#9129)

Signed-off-by: Ticheng Lin <[email protected]>

---------

Signed-off-by: Ticheng Lin <[email protected]>
Signed-off-by: Kiran Reddy <[email protected]>
kaushalmahi12 pushed a commit to kaushalmahi12/OpenSearch that referenced this pull request Sep 12, 2023
…rrent execution (opensearch-project#9129)

* Add support for wrapping CollectorManager with profiling during concurrent execution (opensearch-project#9129)

Signed-off-by: Ticheng Lin <[email protected]>

* Add more collectorResult test and work on the PR comments (opensearch-project#9129)

Signed-off-by: Ticheng Lin <[email protected]>

---------

Signed-off-by: Ticheng Lin <[email protected]>
Signed-off-by: Kaushal Kumar <[email protected]>
brusic pushed a commit to brusic/OpenSearch that referenced this pull request Sep 25, 2023
…rrent execution (opensearch-project#9129)

* Add support for wrapping CollectorManager with profiling during concurrent execution (opensearch-project#9129)

Signed-off-by: Ticheng Lin <[email protected]>

* Add more collectorResult test and work on the PR comments (opensearch-project#9129)

Signed-off-by: Ticheng Lin <[email protected]>

---------

Signed-off-by: Ticheng Lin <[email protected]>
Signed-off-by: Ivan Brusic <[email protected]>
@ticheng-aws ticheng-aws self-assigned this Nov 2, 2023
shiv0408 pushed a commit to Gaurav614/OpenSearch that referenced this pull request Apr 25, 2024
…rrent execution (opensearch-project#9129)

* Add support for wrapping CollectorManager with profiling during concurrent execution (opensearch-project#9129)

Signed-off-by: Ticheng Lin <[email protected]>

* Add more collectorResult test and work on the PR comments (opensearch-project#9129)

Signed-off-by: Ticheng Lin <[email protected]>

---------

Signed-off-by: Ticheng Lin <[email protected]>
Signed-off-by: Shivansh Arora <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x Backport to 2.x branch backport-failed
Projects
None yet
3 participants