Repository navigation
fix(map): keep the facet indexes within a quarter of maxMemory or --memory-limit - #819
Open
MathiasVDA wants to merge 4 commits into
Open
MathiasVDA wants to merge 4 commits into
MathiasVDA wants to merge 4 commits into
Conversation
…emory-limit (#809, #796) The map's facet indexes keep each feature's IRI, values and geometry, and nothing bounded them: at 1B triples with --memory-limit 32G the warm-up's indexes held about 40 GB of heap, which took the page cache the store's files need, and short queries became 2 to 5 times slower. A build now counts what it holds as it reads and stops past a quarter of the dataset's maxMemory or of --memory-limit (the lower), less what the other indexes hold. The collection is then counted and drawn with queries, and not tried again (nor queued for the background) until the budget grows. Without either limit nothing changes.
…-4qfh9q # Conflicts: # CHANGELOG.md
2 tasks done
Contributor
Author
|
The Generated by Claude Code |
… them A tile request starts making the collections again on a thread; when that finished before the request read them, the planted non-gzip answer kept for the new data version was served and the test failed with UnexpectedEof. Part of #809
Contributor
Author
|
Approved at 12951fa. I merge it when the tests are green. What I checked beyond the diff: a scratch test with a quota the lines' index just fits in (11 to 20 times the map's caches), three updates and a delete after the warm-up. The index is brought up to date each time and nothing is marked as too large, so the count of Notes, none blocking:
Points 2 and 3 are worth one follow-up issue. Generated by Claude Code |
This branch has not been deployed
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.
Requested by Mathias · project thread
What and why
Closes #809
Closes #796
The 1B slowdown between bb4b496 and 648ec84 comes from memory, not from slower queries. The map's facet indexes (added between the two commits) keep every feature's IRI, values and parsed geometry, and neither
--memory-limitnormaxMemorybounded them. In the 1B runs, the heap after start was 48.9 GB on 648ec84 against 14.1 GB on bb4b496, with only 6.8 GB of it counted. That left the 66 GB store 11 GB of page cache instead of 41 GB, and the warm-up was still building when the bench stopped waiting at 600 s. Short queries became 2 to 5 times slower.The fix gives the facet indexes of a dataset a budget: a quarter of its
maxMemoryor of--memory-limit, whichever is lower.make,update) counts what it holds as it reads: each feature's IRI and values, each geometry and the WKT it keeps. It stops as soon as the build plus the other kept indexes would go past the budget, and logs a line saying so.Store::memory_limit()exposes the--memory-limitvalue to the server.How it was tested
tests/facet_index_budget.rs. Without limits, both indexes are made. With amaxMemorywhose quarter fits the stations but not the lines, the lines fail with the message, are not left for the background,mapCachesstays within the quarter, and the facet counts are the same. A larger quota makes the index again.--memory-limitbounds the indexes the same way.--lib,warm_up,limits,low_zoom,text_tile_memory,tile_cache,feature_list,ogc, pluscargo clippy --all-targetsandcargo fmt --check.osm_scale.py --set a, copied 8 times: 11.7M triples, 2.3M features, a 504 MB store. Release builds, 4 vCPU. Query times are the median of 5 warm runs.--memory-limit 2GWith memory to spare, the queries take the same time on every build, which confirms the 1B difference is page-cache pressure. Without a limit this PR behaves as main (peak 5,526 MiB). The build's count is about 70 % of the real heap (land use: 3.66 GB counted against about 5.4 GB peak), because the queries' own working memory is not counted. The docs say so.
The 1B confirmation needs the next scale run, which is a paid run and needs Mathias's OK.
Documentation
docs/guide/10-maps-and-apis.md) says what the limit does to the layers' indexesdocs/server.md(the map's warm-up,--memory-limit,maxMemory) and the CHANGELOG describe itGenerated by Claude Code