fix: Improve concurrent path_find - #7962
Conversation
Test Report of this PR codeOf note the test repeated between the 3.2.1 release and the PR code the path_find operations runs in each test are 1-1 and in the same order. *Tests are run against the admin port so that throttling does not factor into the load. Path find configuration used. Test tool used -> test-pathfind please use this tool to run your own tests. *The report that was added here will be updated when this PR is reopened |
I had Claude do a review of this PR (collapsed here because it's fairly lengthy). It had some fairly serious concerns.OverviewReworks
The direction is sound and the diagnosis (trust-line reloads + full graph search on every close) is credible. But several changes look unsafe or regressive as written. Correctness1. Data race + potential dangling
Minimum fix: have 2. 3. Dropping the covering path is a behavior regression, not just a shape change. 4. 5. 6. Staleness window. Performance
Style / conventions
TestsNo test changes at all for: incremental revalidation, staggered rediscovery, parallel steady updates, the 6-path shape,
The load-test numbers are the core justification, but the harness isn't in the PR — please land it (or link it) so the claims are reproducible in CI. Suggested splitThis is ~1400 lines mixing five independent changes. I'd separate: (a) AssetCache restructure, (b) incremental revalidate + staggering, (c) parallel scheduling, (d) path-set shape / covering-path removal, (e) counters. (d) is a client-visible behavior change that deserves its own review and an |
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
Keep pathfinding best-effort while making steady-state WS path_find much cheaper under high concurrency: - AssetCache: one full outgoing trust-line vector per account, chunked load, shared_mutex hits, soft advanceLedger reuse, session pins, soft line budgets - Incremental revalidate between full Pathfinder rediscoveries (staggered) - Parallel steady revalidate via JtPathFindWork; first updates stay serial - Return up to six path alternatives without full-liquidity covering spares - get_counts pathfind cache counters; [path_find] config knobs Tests: - xrpl.rpc.AssetCache (budget, advanceLedger, session pins, TSan concurrency) - xrpl.rpc.PathFindSub (revalidate, multi-session, 6-path, stagger, mid-close) - tools/pathfind-loadtest links the external load harness for perf numbers
3e10b2c to
3a0d5bf
Compare
|
This PR has conflicts, please resolve them in order for the PR to be reviewed. |
|
All conflicts have been resolved. Assigned reviewers can now start or resume their review. |
Lower cache_reuse_ledgers (6, max 64), full_search_interval (3, max 100), and line_chunk_size max (1024) so default path_find stays fresher under load.
- Serial-fallback for runParallel when JobQueue has one worker (stand-alone) - Rebuild requests_ with keepAlive so ~PathRequest cannot re-enter mid-erase - Lock publishCacheStats baselines against close-thread races - Release claimed sessions if serial first-update throws (no frozen inProgress) - Shared-lock pin check so hot-path getRippleLines does not exclusive-lock - Regression: single-worker multi-session PathFindSub case
- Match Application JobQueue sizing (standalone before workers) so runParallel never fork-joins on a 1-thread stand-alone pool - expandIncompleteLinesForSession for one-shot ripple_path_find so shared AssetCache is not fully drained under unique_lock - MidCloseBag detaches timer/JtRpc handlers before destroy (io outlives mgr) - Regression: workers=2 + forceMultiThread=false single-worker hang case
…n-out - Soft advance erases incomplete progressive fills (no cross-ledger DirCursor) - Closed waves pin lastIndex_ from inLedger seq, not lagging cache view - Restored revalidate failures: full_reply=false + path_revalidate_failed - Fork-join only when JobQueue has >=3 workers (serial otherwise) - API-CHANGELOG documents path_revalidate_failed
Improve concurrent path_find with shared AssetCache, incremental revalidation, parallel steady updates, and up to six paths without full-liquidity spare slots.
High Level Overview of Change
Make concurrent WebSocket
path_findcheaper under load: shared trust-line cache, revalidate between full searches, parallel steady updates, up to 6 path alternatives (no full-liquidity spare).Target: ~100 sessions, consensus
FULL/load_factor≈ 1, mean update gap ~ ledger close (under 4s).Context of Change
Under many concurrent
path_findsessions, most cost was trust-line reloads, full Pathfinder every update, and reprocessing everyone on new subscriptions.Steady state is now cheaper (still best-effort):
rippleCalculateon known paths; staggered full Pathfinder rediscovery[path_find]knobs;get_countspathfind cache countersAPI Impact
libxrplchange (any change that may affectlibxrplor dependents oflibxrpl)Notes: request/response shapes unchanged.
paths_computedmay list up to 6 paths.get_countscounters are monitoring-only. No libxrpl / peer changes.Before / After
Loadtest (100 concurrent WS
path_find, ramp → observe → ramp-down):server_stateload_factorTest Plan
xrpl.rpc.AssetCache— budget, advanceLedger, pins, concurrencyxrpl.rpc.PathFindSub— revalidate, multi-session, 6-path, stagger, mid-closexrpl.app.Path/PathMPTtools/pathfind-loadtest— ramp 100, FULL + countersFuture Tasks