Skip to content

Transfers/Transactions performance improvements - #1628

Open
stefangutica wants to merge 4 commits into
developmentfrom
transfers-transactions-improvements
Open

Transfers/Transactions performance improvements#1628
stefangutica wants to merge 4 commits into
developmentfrom
transfers-transactions-improvements

Conversation

@stefangutica

@stefangutica stefangutica commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

Reasoning

  • processTransactions issued one Redis GET per transaction to resolve pending results, so a single page meant N sequential round trips.
  • Transaction actions were computed one at a time, serializing every cache / data-api call behind the previous transaction.
  • Both are independent per transaction, so all of this page-level work was serialized for no reason.

Proposed Changes

  • Resolve pending results for the whole page with a single batched getMany call, keeping the existing 20-minute cutoff.
  • Compute transaction actions in parallel batches of 25 (BatchUtils.splitArrayIntoChunks), preserving the per-transaction error handling so one failure cannot fail the page.
  • Run the two independent stages concurrently, and build the recognizers list with a single atomic assignment so concurrent callers cannot observe a partial or duplicated list.

How to test

  • npm run test:unit — new tests cover the action batching, the batched pending-results lookup and the per-transaction error isolation.
  • Diff responses before/after on /transactions and /transfers (including withScResults, withOperations, withLogs, withUsername, withActionTransferValue) — the payload must be identical.
  • Check that recent pending transactions still report pendingResults: true / status: pending, and that MEX transactions still return their mex action rather than a generic scCall.

@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown

k6 load testing comparison.
Base Commit Hash: ba269ea
Target Commit Hash: 5752887

Metric Base Target Diff
AvgMax9095AvgMax9095AvgMax9095
Mex34.29411.8947.8852.8641.73632.1353.5557.58+21.69% 🔴+53.47% 🔴+11.86% 🔴+8.93% 🔴
Transactions64.4514315.8253.3257.2447.13778.0756.1458.82-26.87% ✅-94.56% ✅+5.29% 🔴+2.77% 🔴
Blocks41.16639.7650.8854.7850.02924.2856.0458.72+21.52% 🔴+44.47% 🔴+10.15% 🔴+7.19% 🔴
Tokens34.15413.2147.7752.8741.54454.8853.2757.66+21.62% 🔴+10.08% 🔴+11.52% 🔴+9.07% 🔴
Pool34.19412.8047.8152.8441.55496.6953.2857.65+21.54% 🔴+20.32% 🔴+11.43% 🔴+9.10% 🔴
Nodes59.7813684.5363.80101.2570.8018514.4858.0364.46+18.44% 🔴+35.30% 🔴-9.04% ✅-36.34% ✅
Accounts40.70681.1552.0055.8441.17191.8753.4157.51+1.14% 🔴-71.83% ✅+2.70% 🔴+2.99% 🔴
Test Run Duration60005.2760002.10

Legend: Avg - Average Response Time, Max - Maximum Response Time, 90 - 90th Percentile, 95 - 95th Percentile
All times are in milliseconds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant