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

Improve Auto-Analyze Mechanism for Better Concurrency #55618

Closed
Rustin170506 opened this issue Aug 23, 2024 · 7 comments · Fixed by #55848
Closed

Improve Auto-Analyze Mechanism for Better Concurrency #55618

Rustin170506 opened this issue Aug 23, 2024 · 7 comments · Fixed by #55848
Labels
sig/planner SIG: Planner type/enhancement The issue or PR belongs to an enhancement.

Comments

@Rustin170506
Copy link
Member

Rustin170506 commented Aug 23, 2024

Background

The current implementation of AnalyzeHighestPriorityTables uses a WaitGroupWrapper to execute analysis jobs concurrently. This approach lacks flexibility in managing running jobs.

Proposed Changes

  1. Implement a dynamic job management system that maintains a constant number of running jobs up to the maximum concurrency limit.
  2. Add functionality to track currently running analysis jobs by table ID.
  3. Allow for dynamic adjustment of concurrency based on the AutoAnalyzeConcurrency parameter.
  4. Replace the WaitGroupWrapper with individual goroutines for each job.

Implementation Details

  1. Add a runningJobs map to the Refresher struct to track active jobs.
  2. Modify AnalyzeHighestPriorityTables to:
    • Check the current number of running jobs before starting new ones.
    • Use goroutines for each job instead of a WaitGroupWrapper.
    • Dynamically start new jobs as others complete, maintaining the desired concurrency.
  3. Implement proper locking mechanisms to ensure thread-safety when managing the job queue and running jobs.
  4. Add a method to get the current running jobs.

Expected Benefits

  • More efficient use of system resources by maintaining a constant number of running jobs.
  • Improved flexibility in managing analysis jobs, allowing for better responsiveness to system changes.
  • Enhanced ability to monitor and control the auto-analyze process.
  • Prepare for the new priority queue.
@Rustin170506 Rustin170506 added type/enhancement The issue or PR belongs to an enhancement. sig/planner SIG: Planner labels Aug 23, 2024
@hawkingrei

This comment was marked as resolved.

@hawkingrei

This comment was marked as resolved.

@Rustin170506

This comment was marked as resolved.

@Rustin170506

This comment was marked as resolved.

@hawkingrei

This comment was marked as resolved.

@Rustin170506

This comment was marked as resolved.

@Rustin170506

This comment was marked as resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/planner SIG: Planner type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
2 participants