Skip to content

⚡ Parallelize groups apply processing#63

Open
ffalcinelli wants to merge 1 commit intomainfrom
optimize-groups-apply-4149027980746363191
Open

⚡ Parallelize groups apply processing#63
ffalcinelli wants to merge 1 commit intomainfrom
optimize-groups-apply-4149027980746363191

Conversation

@ffalcinelli
Copy link
Copy Markdown
Owner

💡 What: Optimized the apply_groups function in src/apply.rs by introducing parallel processing with tokio::task::JoinSet.
🎯 Why: The previous implementation processed each group YAML file sequentially, which was inefficient due to blocking on network I/O for each Keycloak API call. Parallelization significantly reduces the total time required to apply configurations with many groups.
📊 Measured Improvement: While a local benchmark was implemented (benches/bench_apply_groups.rs), network restrictions in the current environment prevented establishing a precise baseline. However, the change follows the identical parallelization pattern already successfully employed for Roles and Clients in the same module, ensuring architectural consistency and expected performance gains.


PR created automatically by Jules for task 4149027980746363191 started by @ffalcinelli

Refactored `apply_groups` in `src/apply.rs` to use `tokio::task::JoinSet`
for parallel processing of group configurations. This replaces the
sequential await loop with concurrent I/O operations, matching the
established pattern used for roles and clients.

- Wrapped `existing_groups_map` in `Arc` for thread-safe sharing.
- Cloned `KeycloakClient` and map for each spawned task.
- Added `benches/bench_apply_groups.rs` for performance measurement.
- Updated `Cargo.toml` to include the new benchmark.

Co-authored-by: ffalcinelli <1167082+ffalcinelli@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

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.

1 participant