Skip to content

Process multiple batches of Biosample IDs in parallel (performance optimization) - #1390

Merged
eecavanna merged 10 commits into
mainfrom
0000-process-biosample-id-batches-in-parallel
Feb 14, 2026
Merged

eecavanna merged 10 commits into
mainfrom
0000-process-biosample-id-batches-in-parallel

Conversation

@eecavanna

@eecavanna eecavanna commented Feb 14, 2026 •

Copy link
Copy Markdown
Collaborator

On this branch, I made it so the "/data_objects/study/{study_id}" API endpoint, which already breaks large sets of Biosample IDs into batches, processes up to 8 batches in parallel.

Locally, this has decreased response time for our "problematic request" (i.e. getting all data objects for study nmdc:sty-11-34xj1150) by 25%, while having no impact on the response time of a "non-problematic request" (i.e. getting all data objects for study nmdc:sty-11-aygzgv51).

Details

I also decreased the batch size from 1000 to 500, since—with this parallelism—the latter was producing slightly shorter response times than the former.

I also added a background task that will delete obsolete "linked_instances" collections, which can otherwise accumulate in the database.

Related issue(s)

Fixes #1391

Related subsystem(s)

  • Runtime API (except the Minter)
  • Minter
  • Dagster
  • Project documentation (in the docs directory)
  • Translators (metadata ingest pipelines)
  • MongoDB migrations
  • Other

Testing

  • I tested these changes (explain below)
  • I did not test these changes

I tested these changes by performing the "problematic request" and "non-problematic request" locally many times, on both this branch and on main, with the same database in each case, and comparing the response times in all cases. I also confirmed all tests passed, as usual.

Documentation

  • I have not checked for relevant documentation yet (e.g. in the docs directory)
  • I have updated all relevant documentation so it will remain accurate
  • Other (explain below)

There is no documentation related to this.

Maintainability

  • Every Python function I defined includes a docstring (test functions are exempt from this)
  • Every Python function parameter I introduced includes a type hint (e.g. study_id: str)
  • All "to do" or "fix me" Python comments I added begin with either # TODO or # FIXME
  • I used black to format all the Python files I created/modified
  • The PR title is in the imperative mood (e.g. "Do X") and not the declarative mood (e.g. "Does X" or "Did X")

@eecavanna eecavanna self-assigned this Feb 14, 2026
@eecavanna
eecavanna marked this pull request as ready for review February 14, 2026 08:56
@eecavanna
eecavanna requested a review from Copilot February 14, 2026 08:56

This comment was marked as resolved.

@eecavanna eecavanna changed the title Process batches of Biosample IDs in parallel (performance optimization) Process multiple batches of Biosample IDs in parallel (performance optimization) Feb 14, 2026

This comment was marked as resolved.

@eecavanna
eecavanna merged commit 980d2ee into main Feb 14, 2026
@eecavanna
eecavanna deleted the 0000-process-biosample-id-batches-in-parallel branch February 14, 2026 22:22
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.

Endpoint GET /data_objects/study/{study_id} times out for large studies (still)

2 participants