Repository navigation
perf(station): moonproto 98420c6d and a markets_version-keyed coin cache - #1149
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.
What & why
Two commits, both station CPU work from #1081 and MoonProto#17.
MarketsState::markets_version()becomes public. Every station client is Compact; the terminal (Auto, 5 ms) is unaffected. Only the two moonproto/polling source hashes move inCargo.lock— a plaincargo update -p moonprotoalso shifted unrelatedwindows-sysversions, which this lock avoids.markets_version.MarketDataSource::resolve_marketread the provider catalog twice —search_marketsandmarket_labels, each from its own snapshot. Both now run on one snapshot throughCatalogLookup(market/source/catalog_lookup.rs);resolve_marketdelegates to it andmarket_labelsshares the same per-market label rule, so every caller's answer is unchanged. The tape catch-up listing'sCoinMarketsadds that snapshot'smarkets_versionto its key and caches "not found" again: perf(station): resolve each listed coin's market once per catalog revision #1143 had to search refused coins every time, because the feed's catalog revision moves only when the feed thread drains the market-list event, a moment after the snapshot already holds the new list.Measured on our 28-core station (same process, idle wait alternated every 5 minutes, ~35k datagrams a minute both ways):
Notable decisions
catalog_revisionstays in the cache key besidemarkets_version: moonproto documents that a list apply which only changes known markets may leave the version where it was.X s resolvingfigure.Known limitations
lifecycle.rsputsmarkets_versioninto the key: moon-core has no fixture for a liveMoonClientsnapshot. The label and pick rules stay covered bylabel_tests.rs, and the listing log line'smarket searchesshows the effect on a running station.cargo zigbuildstation, whose allocator is Zig's libc rather than musl's; they compare 15 against 30 ms, not against a release build.Issues
Refs #1081 — station CPU; the out-of-memory cause it tracks is still open.
How to verify
fmt exit 0, build exit 0, clippy zero warnings, 8644 tests green (TEMP on a drive with at least 10 % free:
trade_cache::full_compaction_preserves_queued_insertsrefuses to VACUUM below the disk reserve).