Skip to content

Optimize health check response using parallel queries #2714

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

souvikghosh04
Copy link
Contributor

@souvikghosh04 souvikghosh04 commented Jun 9, 2025

Why make this change?

What is this change?

  • Provide option to specify max degree of query parallelism as a config option
  • The default value is 4 and max allowed value is 8. System automatically adjusts itself within this range in case a value specified is lower or higher
  • .Net framework's Parallel tasks are used to run queries in parallel

Usage

  • max-query-parallelism can be set in the config, e.g.: "runtime": { "health": { "max-query-parallelism": 8 } }
  • Null value and out of range min-value defaults to 4 and out of range max-value defaults to 8

How was this tested?

  • Integration Tests
  • Unit Tests

Sample Request(s)

@souvikghosh04
Copy link
Contributor Author

/azp run

Copy link

Azure Pipelines successfully started running 6 pipeline(s).

@souvikghosh04 souvikghosh04 added this to the 1.6 milestone Jun 9, 2025
@souvikghosh04 souvikghosh04 linked an issue Jun 9, 2025 that may be closed by this pull request
@souvikghosh04 souvikghosh04 requested a review from Copilot June 9, 2025 15:31
@souvikghosh04 souvikghosh04 self-assigned this Jun 9, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR improves the health check endpoint’s performance by parallelizing entity queries and exposing a configurable degree of parallelism.

  • Introduce a max-query-parallelism config option (default 4, max 8) with automatic range clamping
  • Update HealthCheckHelper to run entity health checks in parallel via Parallel.ForEachAsync
  • Add model, converter, constants, and JSON schema entries for the new config

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/Service/HealthCheck/HealthCheckHelper.cs Parallelize entity health checks and aggregate results
src/Config/ObjectModel/EntityCacheOptions.cs Define default and limit constants for parallelism
src/Config/HealthCheck/RuntimeHealthCheckConfig.cs Add MaxQueryParallelism property with default logic
src/Config/Converters/RuntimeHealthOptionsConvertorFactory.cs Parse and clamp max-query-parallelism from JSON
schemas/dab.draft.schema.json Add schema definition for max-query-parallelism
Comments suppressed due to low confidence (1)

src/Config/ObjectModel/EntityCacheOptions.cs:39

  • [nitpick] The suffix _LIMIT is a bit ambiguous. Consider renaming to DEFAULT_MAX_QUERY_PARALLELISM_MAX for symmetry with DEFAULT_MAX_QUERY_PARALLELISM.
public const int DEFAULT_MAX_QUERY_PARALLELISM_LIMIT = 8;

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@souvikghosh04 souvikghosh04 changed the title Usr/sogh/parallelqueries Health Check: Optimize health check response using parallel queries Jun 10, 2025
@souvikghosh04 souvikghosh04 changed the title Health Check: Optimize health check response using parallel queries Optimize health check response using parallel queries Jun 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

HealthEndpoint: Parallel Queries to DB
2 participants