Load test with the Full dataset, and a streaming import (#19) #59
+158
−18
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.
Closes #19.
The import read the whole file with readFileSync. The Full ratings file is 1 GB, which is larger as
one string than Node allows, so the import crashed before it started. It now reads the ratings line
by line and writes them in batches of 5 000, so memory use stays flat whichever version is loaded.
The wines file is still read at once (34 MB, and it has commas inside quoted fields).
Loaded the Full version locally: 100 646 wines and 21 013 536 ratings.
With 21 million ratings in the database, requests stay fast: 55 ms for the first page, 49 ms for a
search, 23 ms for filters with sorting, and 57 ms for the filter counts. The database is 2.4 GB.
The VM keeps the Slim version: Full needs more disk than it has to spare.
Also adds splitCsvLine with tests, and the numbers are documented in README and docs/vm.md.
Tested: npm run check passes, 96 backend tests pass.