Skip to content

Conversation

SergeyGaluzo
Copy link
Contributor

@SergeyGaluzo SergeyGaluzo commented Aug 19, 2025

Refactoring to support dynamic allocation of threads/tasks in job hosting. After this change number of tasks can be adjusted without restarting job hosting. All other current functionality is preserved.

@SergeyGaluzo SergeyGaluzo added this to the CY25Q3/2Wk07 milestone Aug 19, 2025
@SergeyGaluzo SergeyGaluzo requested a review from a team as a code owner August 19, 2025 20:51
@SergeyGaluzo SergeyGaluzo added Enhancement Enhancement on existing functionality. Azure Healthcare APIs Label denotes that the issue or PR is relevant to the FHIR service in the Azure Healthcare APIs Schema Version unchanged labels Aug 19, 2025
@microsoft microsoft deleted a comment from azure-pipelines bot Aug 22, 2025
Copy link

@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 refactors the job hosting logic to support dynamic allocation of threads/tasks. The primary goal is to enable adjusting the number of tasks without restarting the job hosting service while preserving all existing functionality.

Key changes:

  • Replaces static thread allocation with dynamic task management using a concurrent dictionary to track running jobs targets
  • Introduces real-time task scaling based on configurable targets per queue type
  • Adds comprehensive logging and monitoring improvements for better observability

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.

File Description
JobHosting.cs Complete refactor of job execution logic from static thread pool to dynamic task management with configurable targets
ImportTests.cs Adds E2E test to verify job dequeue behavior and polling frequency under the new dynamic system

@SergeyGaluzo
Copy link
Contributor Author

SergeyGaluzo commented Aug 26, 2025

@brendankowitz Thanks for asking for AI review. I found 2 wrong AI comments. Hope they fix that.

@SergeyGaluzo SergeyGaluzo enabled auto-merge (squash) August 26, 2025 00:46
@SergeyGaluzo SergeyGaluzo disabled auto-merge August 26, 2025 17:00
@jestradaMS
Copy link
Contributor

Changes look good, however one item we should consider is how the new behavior will shutdown the workers and restart them as needed vs. starting them and polling at startup. While possibly minimal, GC and task creation overhead could increase especially under high load with high number of workers.

@SergeyGaluzo
Copy link
Contributor Author

SergeyGaluzo commented Aug 26, 2025

Changes look good, however one item we should consider is how the new behavior will shutdown the workers and restart them as needed vs. starting them and polling at startup. While possibly minimal, GC and task creation overhead could increase especially under high load with high number of workers.

This is a valid concern for very high frequences, thousands of operations per second. I think it is far from what we deal here (single digit operations per second). I also performed full scale testing on $import. No noticeable increase in app resource utilization.

@SergeyGaluzo SergeyGaluzo merged commit 09dbfb1 into main Aug 26, 2025
46 of 47 checks passed
@SergeyGaluzo SergeyGaluzo deleted the users/sergal/jobs branch August 26, 2025 20:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Azure Healthcare APIs Label denotes that the issue or PR is relevant to the FHIR service in the Azure Healthcare APIs Enhancement Enhancement on existing functionality. Schema Version unchanged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants