Skip to content

feat(backend): batching worker calls - #3956

Open
njlie wants to merge 21 commits into
mainfrom
nl/batch-workers
Open

njlie wants to merge 21 commits into
mainfrom
nl/batch-workers

Conversation

@njlie

@njlie njlie commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Changes proposed in this pull request

  • All worker jobs have a configurable batch size for the number of rows they process in a single iteration.

Context

Optimization work done by @bosbaber and I at the Rafiki/Cards Work Week in July.

Checklist

  • Related issues linked using fixes #number
  • Tests added/updated
  • Make sure that all checks pass
  • Bruno collection updated (if necessary)
  • Documentation issue created with user-docs label (if necessary)
  • OpenAPI specs updated (if necessary)

@netlify

netlify Bot commented Jul 27, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for brilliant-pasca-3e80ec canceled.

Name Link
🔨 Latest commit 4f9ba6a
🔍 Latest deploy log https://app.netlify.com/projects/brilliant-pasca-3e80ec/deploys/6a67e2763271ce000808f2f5

@github-actions github-actions Bot added type: tests Testing related pkg: backend Changes in the backend package. type: source Changes business logic labels Jul 27, 2026
@github-actions

github-actions Bot commented Jul 27, 2026 •

Copy link
Copy Markdown

🚀 Performance Test Results

Test Configuration:

  • VUs: 4
  • Duration: 1m0s

Test Metrics:

  • Requests/s: 48.26
  • Iterations/s: 12.07
  • Failed Requests: 0.00% (0 of 2906)
📜 Logs

> performance@1.0.0 run-tests:testenv /home/runner/work/rafiki/rafiki/test/performance
> ./scripts/run-tests.sh -e test -k -q --vus 4 --duration 1m

Cloud Nine GraphQL API is up: http://localhost:3101/graphql
Cloud Nine Wallet Address is up: http://localhost:3100/
Happy Life Bank Address is up: http://localhost:4100/
cloud-nine-wallet-test-backend already set
cloud-nine-wallet-test-auth already set
happy-life-bank-test-backend already set
happy-life-bank-test-auth already set
     data_received..................: 1.0 MB 17 kB/s
     data_sent......................: 2.2 MB 36 kB/s
     http_req_blocked...............: avg=8.09µs  min=2.19µs   med=4.62µs   max=1.93ms   p(90)=5.97µs   p(95)=6.57µs  
     http_req_connecting............: avg=1.05µs  min=0s       med=0s       max=1.89ms   p(90)=0s       p(95)=0s      
     http_req_duration..............: avg=82.18ms min=10.98ms  med=62.9ms   max=635.1ms  p(90)=158.42ms p(95)=181.53ms
       { expected_response:true }...: avg=82.18ms min=10.98ms  med=62.9ms   max=635.1ms  p(90)=158.42ms p(95)=181.53ms
     http_req_failed................: 0.00%  ✓ 0         ✗ 2906
     http_req_receiving.............: avg=85.43µs min=19.49µs  med=67.65µs  max=2.6ms    p(90)=115.26µs p(95)=169.94µs
     http_req_sending...............: avg=42.13µs min=9.38µs   med=22.3µs   max=3.39ms   p(90)=52.45µs  p(95)=133.8µs 
     http_req_tls_handshaking.......: avg=0s      min=0s       med=0s       max=0s       p(90)=0s       p(95)=0s      
     http_req_waiting...............: avg=82.06ms min=10.87ms  med=62.72ms  max=635.04ms p(90)=158.3ms  p(95)=181.01ms
     http_reqs......................: 2906   48.263046/s
     iteration_duration.............: avg=330.9ms min=229.52ms med=316.07ms max=1.41s    p(90)=396.93ms p(95)=422.57ms
     iterations.....................: 727    12.074066/s
     vus............................: 4      min=4       max=4 
     vus_max........................: 4      min=4       max=4 

@njlie
njlie marked this pull request as draft July 27, 2026 22:58
@njlie
njlie marked this pull request as ready for review July 28, 2026 15:38

outgoingPaymentWorkers: envInt('OUTGOING_PAYMENT_WORKERS', 1),
outgoingPaymentWorkerIdle: envInt('OUTGOING_PAYMENT_WORKER_IDLE', 10), // milliseconds
outgoingPaymentBatchSize: envInt('OUTGOING_PAYMENT_WORKER_BATCH_SIZE', 1),

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made the default batch size 1 so as not to make any unexpected changes to existing deployments.

@mkurapov

Copy link
Copy Markdown
Collaborator

@njlie can we close this if we found that it was not providing much performance gain?

This branch has not been deployed

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

Labels

pkg: backend Changes in the backend package. type: source Changes business logic type: tests Testing related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants