Repository navigation
Process multiple batches of Biosample IDs in parallel (performance optimization) - #1390
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 studynmdc: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)
docsdirectory)Testing
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
docsdirectory)There is no documentation related to this.
Maintainability
study_id: str)# TODOor# FIXMEblackto format all the Python files I created/modified