Skip to content

⚡ perf(catalog): optimize get_service call - #9442

Merged
giancarloromeo merged 16 commits into
ITISFoundation:masterfrom
giancarloromeo:perf/catalog-get-service-queries
Aug 28, 2026
Merged

⚡ perf(catalog): optimize get_service call#9442
giancarloromeo merged 16 commits into
ITISFoundation:masterfrom
giancarloromeo:perf/catalog-get-service-queries

Conversation

@giancarloromeo

@giancarloromeo giancarloromeo commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

What do these changes do?

This PR optimizes the repository worflow for the get_service call.

For each get_catalog_service call, this spares:

  • One redundant can_get_service SQL query, reducing queries from 4 to 3.
  • Three connection-pool checkouts, using one shared connection instead of four.
  • A server-side cursor and asynchronous stream for the small bounded access-rights result set.
  • Separate connection scopes for service metadata and history reads.

Related issue/s

How to test

Dev-ops

  • No changes.

@giancarloromeo giancarloromeo added this to the Toynbee Tiles milestone Jul 15, 2026
@giancarloromeo giancarloromeo self-assigned this Jul 15, 2026
@github-actions github-actions Bot added the a:catalog catalog service label Jul 15, 2026
@codecov

codecov Bot commented Jul 15, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 89.18919% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.01%. Comparing base (dc5783d) to head (8d2b217).

❗ There is a different number of reports uploaded between BASE (dc5783d) and HEAD (8d2b217). Click for more details.

HEAD has 27 uploads less than BASE
Flag BASE (dc5783d) HEAD (8d2b217)
unittests 28 1
Additional details and impacted files
@@             Coverage Diff             @@
##           master    #9442       +/-   ##
===========================================
- Coverage   88.18%   77.01%   -11.18%     
===========================================
  Files        1559      311     -1248     
  Lines       60596    16388    -44208     
  Branches     1583      203     -1380     
===========================================
- Hits        53436    12621    -40815     
+ Misses       6739     3715     -3024     
+ Partials      421       52      -369     
Flag Coverage Δ
integrationtests 71.87% <ø> (-0.17%) ⬇️
unittests 91.90% <89.18%> (+4.88%) ⬆️
Components Coverage Δ
pkg_aws_library ∅ <ø> (∅)
pkg_celery_library ∅ <ø> (∅)
pkg_dask_task_models_library ∅ <ø> (∅)
pkg_models_library ∅ <ø> (∅)
pkg_notifications_library ∅ <ø> (∅)
pkg_postgres_database ∅ <ø> (∅)
pkg_service_integration ∅ <ø> (∅)
pkg_service_library ∅ <ø> (∅)
pkg_settings_library ∅ <ø> (∅)
pkg_simcore_sdk 66.69% <ø> (-19.73%) ⬇️
agent ∅ <ø> (∅)
api_server ∅ <ø> (∅)
autoscaling ∅ <ø> (∅)
catalog 91.90% <89.18%> (-0.61%) ⬇️
clusters_keeper ∅ <ø> (∅)
dask_sidecar ∅ <ø> (∅)
datcore_adapter ∅ <ø> (∅)
director ∅ <ø> (∅)
director_v2 78.80% <ø> (-13.29%) ⬇️
dynamic_scheduler ∅ <ø> (∅)
dynamic_sidecar 72.51% <ø> (-16.15%) ⬇️
efs_guardian ∅ <ø> (∅)
invitations ∅ <ø> (∅)
payments ∅ <ø> (∅)
resource_usage_tracker ∅ <ø> (∅)
storage ∅ <ø> (∅)
webclient ∅ <ø> (∅)
webserver ∅ <ø> (∅)

Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dc5783d...8d2b217. Read the comment docs.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread services/catalog/src/simcore_service_catalog/repository/groups.py
@giancarloromeo giancarloromeo added the t:maintenance Maintenance work; used to filter tasks for end-of-sprint reporting in Review (Agreed July 3, Retro) label Jul 16, 2026
@sonarqubecloud

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Optimizes catalog service retrieval by reusing database connections and avoiding a redundant permission query.

Changes:

  • Reuses one connection across access-rights and service queries.
  • Adds optional connection support to repository read methods.
  • Simplifies result loading and validation.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
service/catalog_services.py Optimizes service retrieval and centralizes access-right validation.
repository/services.py Supports shared connections for service queries.
repository/groups.py Supports shared connections and simplifies result validation.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@giancarloromeo giancarloromeo changed the title ⚡ perf(catalog): optimize get service call ⚡ perf(catalog): optimize get_service call Aug 28, 2026
@giancarloromeo
giancarloromeo marked this pull request as ready for review August 28, 2026 08:25
@giancarloromeo giancarloromeo modified the milestones: Kula Ring, War Pigs Aug 28, 2026

@bisgaard-itis bisgaard-itis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks a lot for the effort 🙏🏻

@giancarloromeo

Copy link
Copy Markdown
Contributor Author

Thanks a lot for the effort 🙏🏻

Com'on! This was an easy one :D

@giancarloromeo
giancarloromeo enabled auto-merge (squash) August 28, 2026 09:11
@giancarloromeo
giancarloromeo merged commit b722465 into ITISFoundation:master Aug 28, 2026
97 of 100 checks passed
@giancarloromeo
giancarloromeo deleted the perf/catalog-get-service-queries branch August 28, 2026 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a:catalog catalog service t:maintenance Maintenance work; used to filter tasks for end-of-sprint reporting in Review (Agreed July 3, Retro)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants