Implement incremental json loading#389
Merged
Merged
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #389 +/- ##
=======================================
Coverage 98.51% 98.51%
=======================================
Files 33 33
Lines 1948 1948
=======================================
Hits 1919 1919
Misses 29 29 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Collaborator
|
@m-goggins when you ran the test on 5 million. Did you happen to monitor memory usage over that 5 min span? Did the program quickly reach its max memory usage, or did it slowly rise over the entire 5 mins? Also, curious as to what the total amount of memory required was. |
…om/CDCgov/RecordLinker into implement-incremental-json-loading
ericbuckley
approved these changes
May 28, 2025
ericbuckley
left a comment
Collaborator
There was a problem hiding this comment.
Looks good @m-goggins just one small suggestion with the memory tracking code.
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.
Description
This PR updates the load testing scrambler to load and work on a single cluster at a time from a very large (~2GB) file of generated data. I used
ijsonto help with the incremental json loading, which fortunately allows us to read in each cluster individually and as a whole rather than in bytes at a time.To test this, I generated 1.5 million clusters (each with a single record) using the
gen_seed_data_script.py. The resulting file was roughly 2GB (200MB when zipped). I then ran the scrambler on the unzipped version of the file and was able to sample and generate ~5 million scrambled records in 5 minutes on my local.python3 -m tests.load.scripts.scramble_data --file="./test_original_data.json" --max-seed-records 5000000Related Issues
Closes #387
Additional Notes
The next bit of work will be updating the locustfile to reflect the per cluster randomization and ensuring that we hit the
/seedendpoint with only 100 records at a time usingijsonwith a batching function.<--------------------- REMOVE THE LINES BELOW BEFORE MERGING --------------------->
Checklist
Please review and complete the following checklist before submitting your pull request:
Checklist for Reviewers
Please review and complete the following checklist during the review process: