Cache optimisation - #879
Closed
Peter-J-Freeman wants to merge 3 commits into
Closed
Conversation
Implement in-process LRU cache decorators for the SeqFetcher and HGVS data provider (HDP) to reduce repeated lookups during validation. The SeqFetcher cache stores repeated fetch_seq() requests. The HDP cache stores results from get_tx_identity_info(), get_tx_for_gene(), get_pro_ac_for_tx_ac(), get_tx_exons(), get_gene_info() and get_tx_mapping_options(). get_tx_for_region() was intentionally excluded because these genomic coordinate queries are unlikely to repeat during validation. Both wrappers use the decorator pattern and transparently delegate all uncached methods to the underlying implementations. Benchmarking shows the SeqFetcher cache primarily improves runtime stability, while the addition of the HDP cache provides a substantial reduction in overall validation time. Refs #876
Configure the benchmark branch with the current optimal cache configuration identified during performance testing. Changes: - Increase the HGVS internal LRU cache size to 1000 entries. - Leave the SeqFetcher cache enabled. - Disable the Local HDP cache wrapper. - Retain the Local HDP cache implementation in the codebase for future benchmarking and evaluation. Benchmarking indicates that an HGVS LRU cache size of 1000 provides the best balance between execution speed and expected memory usage for the current VariantValidator workload. Increasing the cache beyond 1000 yielded only marginal additional performance improvements.
- Completed benchmarking and optimisation of the VariantValidator
caching framework across the HGVS, SeqFetcher and DBGet layers.
- Selected the final production cache configuration following repeated
benchmarking of the complete test suite:
- Local HGVS HDP cache: disabled
- SeqFetcher cache: enabled (32768 entries)
- Global HGVS cache: 1000 entries
- DBGet cache: enabled (15000 entries)
- Benchmarking demonstrated an expected reduction in full test suite
runtime from approximately 26.6 minutes with all caches disabled to
approximately 4.2 minutes using the recommended configuration,
representing an estimated 84% reduction in execution time
(~6.3× faster).
- Added configurable cache settings and environment variable overrides
for all cache types.
- Added comprehensive cache documentation to settings.py describing:
- available cache types
- default settings
- environment variable overrides
- recommended production configuration
- memory and performance considerations
- Added caching to the principal high-frequency DBGet lookup methods.
- Left the following DBGet methods intentionally uncached:
- get_refseq_id_from_lrg_id()
- get_refseq_transcript_id_from_lrg_transcript_id()
- get_uta_symbol()
- get_hgnc_symbol()
- get_lrg_data_from_lrg_id()
These methods are infrequently used, primarily support LRG or
symbol-conversion workflows, or return complete database rows where
benchmarking showed little practical benefit from caching.
- Added and updated unit tests covering cache behaviour, cache
configuration, environment variable overrides and DBGet caching.
- Removed obsolete cache helper code and updated tests to reflect the
final implementation.
- Cache implementation locations:
- DBGet lookup cache:
VariantValidator/modules/DBGet.py
- SeqFetcher cache:
VariantValidator/modules/vvMixinInit.py
- HGVS HDP cache:
VariantValidator/modules/vvMixinInit.py
- Cache configuration and documentation:
VariantValidator/settings.py
Collaborator
Author
|
This pull request replaces #877 and is the final version based on testing during optimisation |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## regex_removal #879 +/- ##
=================================================
+ Coverage 84.84% 84.86% +0.02%
=================================================
Files 48 48
Lines 14554 14584 +30
=================================================
+ Hits 12348 12377 +29
- Misses 2206 2207 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
No description provided.