René's URL Explorer Experiment


Title: perf(webapp): parallelize streaming batch-item ingest by matt-aitken · Pull Request #3777 · triggerdotdev/trigger.dev · GitHub

Open Graph Title: perf(webapp): parallelize streaming batch-item ingest by matt-aitken · Pull Request #3777 · triggerdotdev/trigger.dev

X Title: perf(webapp): parallelize streaming batch-item ingest by matt-aitken · Pull Request #3777 · triggerdotdev/trigger.dev

Description: Problem The item-streaming endpoint of the two-phase batch API (POST /api/v3/batches/:batchId/items) processed streamed items strictly sequentially. For a batch of many large payloads, each offloaded to object storage inline, this serialized N object-store round-trips inside a single request and could exceed Node's default server.requestTimeout (300s). The webapp then returned 408, which the SDK reads as 408 terminated and retries up to 5 times, turning a slow ingest into a failure that takes tens of minutes to surface. Fix Ingest now runs through p-map over the NDJSON async iterable with bounded concurrency (STREAMING_BATCH_INGEST_CONCURRENCY, default 10): p-map pulls lazily from the stream, so at most concurrency items are read and in-flight at once. Peak memory stays bounded to roughly concurrency × STREAMING_BATCH_ITEM_MAXIMUM_SIZE and request-body backpressure is preserved. Set the env to 1 for fully sequential ingestion (escape hatch). Why this is safe (ordering and idempotency unchanged) Ordering derives from each item's index (enqueue timestamp = batch.createdAt + index), not enqueue order. Dedup is atomic per index in enqueueBatchItem. The NDJSON parser now stamps oversized-item markers with their emit position, removing the consumer's sequential lastIndex assumption (the only order-dependent bit). The count-check and conditional-seal path is untouched. Scope This speeds up every batch ingested through the streaming endpoint, not just large-payload batches. Each item does a per-item Redis enqueue regardless of size, and those now overlap. Large payloads benefit most because they add an object-store offload round-trip on top of the enqueue. Verification Added an integration test (streamBatchItems.test.ts) that drives the real service against Postgres + Redis + RunEngine and times a 150-item batch at increasing concurrency. Object-store offload is modelled as a fixed per-item latency (local round-trips are too small to compare meaningfully): runCount=150 large payloads (10ms/item offload): concurrency=1 1739ms concurrency=10 192ms (9.1x faster) concurrency=50 57ms (30.7x faster) small payloads (Redis enqueue only, no offload): concurrency=1 90ms concurrency=10 24ms (3.7x faster) The test asserts correctness at every concurrency (all items accepted, sealed, enqueued exactly once), that parallel ingest beats the sequential floor, and that the small-payload case is strictly faster than sequential, so the win is not specific to large payloads. Also exercised end-to-end over real HTTP against a local server: a 20-item batch (12MB body) ingests and seals, a re-stream of the sealed batch returns sealed: true with zero re-accepted items (idempotent retry), and an oversized item still seals at its correct index. Existing coverage stays green: concurrent ingest of a 100-item batch, in-flight processing never exceeding the configured concurrency, concurrent dedup on streaming retry, and emit-position marker indexing. Follow-ups (not in this PR) SDK pre-offload of large item payloads (send application/store refs instead of raw blobs) to remove object-store work from the request hot path and shrink the request body. Optional server.requestTimeout bump as a safety net. CI fix Added .github/workflows/codeql.yml to replace GitHub's automatic ("dynamic") CodeQL scanning. The dynamic setup was failing to upload SARIF results because the auto-generated GITHUB_TOKEN lacked the security-events: write permission. The explicit workflow grants that permission at the job level and pins all actions to commit SHAs, consistent with the repo's security conventions. ✅ Checklist I have followed every step in the contributing guide The PR title follows the convention. I ran and tested the code works Testing Integration test (streamBatchItems.test.ts) validates correctness and performance at concurrency 1, 10, and 50 for both large and small payloads. End-to-end verified over real HTTP: 20-item/12MB batch ingests and seals, idempotent retry returns sealed: true, oversized item seals at correct index. Changelog Streaming batch ingest now processes items with bounded concurrency instead of one at a time, so batches of many large payloads ingest far faster and no longer time out. Concurrency is configurable via STREAMING_BATCH_INGEST_CONCURRENCY (default 10); set it to 1 for fully sequential ingestion. Screenshots [Screenshots] 💯

Open Graph Description: Problem The item-streaming endpoint of the two-phase batch API (POST /api/v3/batches/:batchId/items) processed streamed items strictly sequentially. For a batch of many large payloads, each offload...

X Description: Problem The item-streaming endpoint of the two-phase batch API (POST /api/v3/batches/:batchId/items) processed streamed items strictly sequentially. For a batch of many large payloads, each offload...

Opengraph URL: https://github.com/triggerdotdev/trigger.dev/pull/3777

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:4cfd6803-ba22-0a1a-f388-aeac89653428
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idDE3E:1F5CA2:3337B4:4BB248:6AFAE0F8
html-safe-nonce2a5cfb520f7a99d85084f041000d6d22945a4bca2e9793d8fdd8dd9600df6316
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERTNFOjFGNUNBMjozMzM3QjQ6NEJCMjQ4OjZBRkFFMEY4IiwidmlzaXRvcl9pZCI6IjY2NzQ4MTI2ODgwMDc4ODA5NTIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac0ee3a0baf850cbff3dffbbe2b348b9bb907a9671f2bce91be7e66c79932baec0
hovercard-subject-tagpull_request:3770705323
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/triggerdotdev/trigger.dev/pull/3777/files
twitter:imagehttps://avatars.githubusercontent.com/u/10635986?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/10635986?s=400&v=4
og:image:altProblem The item-streaming endpoint of the two-phase batch API (POST /api/v3/batches/:batchId/items) processed streamed items strictly sequentially. For a batch of many large payloads, each offload...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None9d9bd51a568909a83d1abb9d6f74d68f0c87ca85fe3a56d3f5d70d8b89add9f2
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/triggerdotdev/trigger.dev git https://github.com/triggerdotdev/trigger.dev.git
octolytics-dimension-user_id95297378
octolytics-dimension-user_logintriggerdotdev
octolytics-dimension-repository_id572570113
octolytics-dimension-repository_nwotriggerdotdev/trigger.dev
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id572570113
octolytics-dimension-repository_network_root_nwotriggerdotdev/trigger.dev
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release4a7ae932999cc6d511008dbf980ff9efad2a31f7
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/triggerdotdev/trigger.dev/pull/3777/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Ftriggerdotdev%2Ftrigger.dev%2Fpull%2F3777%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Ftriggerdotdev%2Ftrigger.dev%2Fpull%2F3777%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=triggerdotdev%2Ftrigger.dev
Reloadhttps://github.com/triggerdotdev/trigger.dev/pull/3777/files
Reloadhttps://github.com/triggerdotdev/trigger.dev/pull/3777/files
Reloadhttps://github.com/triggerdotdev/trigger.dev/pull/3777/files
triggerdotdevhttps://github.com/triggerdotdev
trigger.devhttps://github.com/triggerdotdev/trigger.dev
Codehttps://github.com/triggerdotdev/trigger.dev
Issues203 (203)https://github.com/triggerdotdev/trigger.dev/issues
Pull requests66 (66)https://github.com/triggerdotdev/trigger.dev/pulls
Discussionshttps://github.com/triggerdotdev/trigger.dev/discussions
Actionshttps://github.com/triggerdotdev/trigger.dev/actions
Projectshttps://github.com/triggerdotdev/trigger.dev/projects
Security and quality39 (39)https://github.com/triggerdotdev/trigger.dev/security
Insightshttps://github.com/triggerdotdev/trigger.dev/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Ftriggerdotdev%2Ftrigger.dev%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Ftriggerdotdev%2Ftrigger.dev%2Fissues%2Fnew%2Fchoose
matt-aitkenhttps://github.com/matt-aitken
mainhttps://github.com/triggerdotdev/trigger.dev/tree/main
feature/tri-10273-managed-runs-streaming-batchtriggerandwait-fails-with-408https://github.com/triggerdotdev/trigger.dev/tree/feature/tri-10273-managed-runs-streaming-batchtriggerandwait-fails-with-408
Conversation 12 https://github.com/triggerdotdev/trigger.dev/pull/3777
Commits 4 https://github.com/triggerdotdev/trigger.dev/pull/3777/commits
Checks 63 https://github.com/triggerdotdev/trigger.dev/pull/3777/checks
Files changed https://github.com/triggerdotdev/trigger.dev/pull/3777/files
Please reload this pagehttps://github.com/triggerdotdev/trigger.dev/pull/3777/files
perf(webapp): parallelize streaming batch-item ingest https://github.com/triggerdotdev/trigger.dev/pull/3777/files#top
Show all changes 4 commits https://github.com/triggerdotdev/trigger.dev/pull/3777/files
7988c31 perf(webapp): parallelize Phase 2 streaming batch-item ingest (TRI-10… matt-aitken May 29, 2026 https://github.com/triggerdotdev/trigger.dev/pull/3777/commits/7988c31e6a5a4aa3e606d875eae3e3b349154c92
5f3b930 fix(webapp): address CodeRabbit review on streaming batch ingest matt-aitken May 30, 2026 https://github.com/triggerdotdev/trigger.dev/pull/3777/commits/5f3b9301fd6a55a81b6f16a292497de7cbc8e9a5
8ce96c3 docs(webapp): trim parallel-batch-item-ingest server-changes note matt-aitken Jun 10, 2026 https://github.com/triggerdotdev/trigger.dev/pull/3777/commits/8ce96c3ec4fb80eed93534078e9d3de13f9011e5
d566bcb test(webapp): add concurrency perf comparison for streaming batch ingest matt-aitken Jun 10, 2026 https://github.com/triggerdotdev/trigger.dev/pull/3777/commits/d566bcb7831f0cd05ea5aa88318a116e64ab37cb
Clear filters https://github.com/triggerdotdev/trigger.dev/pull/3777/files
Please reload this pagehttps://github.com/triggerdotdev/trigger.dev/pull/3777/files
Please reload this pagehttps://github.com/triggerdotdev/trigger.dev/pull/3777/files
parallel-batch-item-ingest.md https://github.com/triggerdotdev/trigger.dev/pull/3777/files#diff-913cd444c60df2c3fda4d3535fa88a4181c4fc89b5663d36cc9cae5ff99de3cf
env.server.ts https://github.com/triggerdotdev/trigger.dev/pull/3777/files#diff-f8823615ef72da3494e74de9e62b2fa31315ed9360f17bc06ab943f4dc25f4fd
api.v3.batches.$batchId.items.ts https://github.com/triggerdotdev/trigger.dev/pull/3777/files#diff-05e3d97bd7ca19b592d26003396b303c5e6840d118d86976f0c3c8f3c1c0135c
streamBatchItems.server.ts https://github.com/triggerdotdev/trigger.dev/pull/3777/files#diff-7653eb5c788470d87c344a8086f3c3ddfcd10c7e8914bb9fc04fc60e8d3b39c6
streamBatchItems.test.ts https://github.com/triggerdotdev/trigger.dev/pull/3777/files#diff-639b8aec7a691875d67d686671295427c8de34eadfab1d135dfce3efa061bffc
webapp.mdx https://github.com/triggerdotdev/trigger.dev/pull/3777/files#diff-f8dd5e39afbaf8985d144672a9af1d24bf9f4b7fe14c1d3156b500cee6da2421
.server-changes/parallel-batch-item-ingest.mdhttps://github.com/triggerdotdev/trigger.dev/pull/3777/files#diff-913cd444c60df2c3fda4d3535fa88a4181c4fc89b5663d36cc9cae5ff99de3cf
View file https://github.com/triggerdotdev/trigger.dev/blob/d566bcb7831f0cd05ea5aa88318a116e64ab37cb/.server-changes/parallel-batch-item-ingest.md
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/triggerdotdev/trigger.dev/pull/3777/{{ revealButtonHref }}
apps/webapp/app/env.server.tshttps://github.com/triggerdotdev/trigger.dev/pull/3777/files#diff-f8823615ef72da3494e74de9e62b2fa31315ed9360f17bc06ab943f4dc25f4fd
View file https://github.com/triggerdotdev/trigger.dev/blob/d566bcb7831f0cd05ea5aa88318a116e64ab37cb/apps/webapp/app/env.server.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/triggerdotdev/trigger.dev/pull/3777/{{ revealButtonHref }}
https://github.com/triggerdotdev/trigger.dev/pull/3777/files#diff-f8823615ef72da3494e74de9e62b2fa31315ed9360f17bc06ab943f4dc25f4fd
https://github.com/triggerdotdev/trigger.dev/pull/3777/files#diff-f8823615ef72da3494e74de9e62b2fa31315ed9360f17bc06ab943f4dc25f4fd
apps/webapp/app/routes/api.v3.batches.$batchId.items.tshttps://github.com/triggerdotdev/trigger.dev/pull/3777/files#diff-05e3d97bd7ca19b592d26003396b303c5e6840d118d86976f0c3c8f3c1c0135c
View file https://github.com/triggerdotdev/trigger.dev/blob/d566bcb7831f0cd05ea5aa88318a116e64ab37cb/apps/webapp/app/routes/api.v3.batches.%24batchId.items.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/triggerdotdev/trigger.dev/pull/3777/{{ revealButtonHref }}
https://github.com/triggerdotdev/trigger.dev/pull/3777/files#diff-05e3d97bd7ca19b592d26003396b303c5e6840d118d86976f0c3c8f3c1c0135c
https://github.com/triggerdotdev/trigger.dev/pull/3777/files#diff-05e3d97bd7ca19b592d26003396b303c5e6840d118d86976f0c3c8f3c1c0135c
apps/webapp/app/runEngine/services/streamBatchItems.server.tshttps://github.com/triggerdotdev/trigger.dev/pull/3777/files#diff-7653eb5c788470d87c344a8086f3c3ddfcd10c7e8914bb9fc04fc60e8d3b39c6
View file https://github.com/triggerdotdev/trigger.dev/blob/d566bcb7831f0cd05ea5aa88318a116e64ab37cb/apps/webapp/app/runEngine/services/streamBatchItems.server.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/triggerdotdev/trigger.dev/pull/3777/{{ revealButtonHref }}
https://github.com/triggerdotdev/trigger.dev/pull/3777/files#diff-7653eb5c788470d87c344a8086f3c3ddfcd10c7e8914bb9fc04fc60e8d3b39c6
https://github.com/triggerdotdev/trigger.dev/pull/3777/files#diff-7653eb5c788470d87c344a8086f3c3ddfcd10c7e8914bb9fc04fc60e8d3b39c6
https://github.com/triggerdotdev/trigger.dev/pull/3777/files#diff-7653eb5c788470d87c344a8086f3c3ddfcd10c7e8914bb9fc04fc60e8d3b39c6
https://github.com/triggerdotdev/trigger.dev/pull/3777/files#diff-7653eb5c788470d87c344a8086f3c3ddfcd10c7e8914bb9fc04fc60e8d3b39c6
https://github.com/triggerdotdev/trigger.dev/pull/3777/files#diff-7653eb5c788470d87c344a8086f3c3ddfcd10c7e8914bb9fc04fc60e8d3b39c6
https://github.com/triggerdotdev/trigger.dev/pull/3777/files#diff-7653eb5c788470d87c344a8086f3c3ddfcd10c7e8914bb9fc04fc60e8d3b39c6
https://github.com/triggerdotdev/trigger.dev/pull/3777/files#diff-7653eb5c788470d87c344a8086f3c3ddfcd10c7e8914bb9fc04fc60e8d3b39c6
https://github.com/triggerdotdev/trigger.dev/pull/3777/files#diff-7653eb5c788470d87c344a8086f3c3ddfcd10c7e8914bb9fc04fc60e8d3b39c6
https://github.com/triggerdotdev/trigger.dev/pull/3777/files#diff-7653eb5c788470d87c344a8086f3c3ddfcd10c7e8914bb9fc04fc60e8d3b39c6
Please reload this pagehttps://github.com/triggerdotdev/trigger.dev/pull/3777/files
https://github.com/triggerdotdev/trigger.dev/pull/3777/files#diff-7653eb5c788470d87c344a8086f3c3ddfcd10c7e8914bb9fc04fc60e8d3b39c6
https://github.com/triggerdotdev/trigger.dev/pull/3777/files#diff-7653eb5c788470d87c344a8086f3c3ddfcd10c7e8914bb9fc04fc60e8d3b39c6
https://github.com/triggerdotdev/trigger.dev/pull/3777/files#diff-7653eb5c788470d87c344a8086f3c3ddfcd10c7e8914bb9fc04fc60e8d3b39c6
https://github.com/triggerdotdev/trigger.dev/pull/3777/files#diff-7653eb5c788470d87c344a8086f3c3ddfcd10c7e8914bb9fc04fc60e8d3b39c6
https://github.com/triggerdotdev/trigger.dev/pull/3777/files#diff-7653eb5c788470d87c344a8086f3c3ddfcd10c7e8914bb9fc04fc60e8d3b39c6
https://github.com/triggerdotdev/trigger.dev/pull/3777/files#diff-7653eb5c788470d87c344a8086f3c3ddfcd10c7e8914bb9fc04fc60e8d3b39c6
https://github.com/triggerdotdev/trigger.dev/pull/3777/files#diff-7653eb5c788470d87c344a8086f3c3ddfcd10c7e8914bb9fc04fc60e8d3b39c6
https://github.com/triggerdotdev/trigger.dev/pull/3777/files#diff-7653eb5c788470d87c344a8086f3c3ddfcd10c7e8914bb9fc04fc60e8d3b39c6
https://github.com/triggerdotdev/trigger.dev/pull/3777/files#diff-7653eb5c788470d87c344a8086f3c3ddfcd10c7e8914bb9fc04fc60e8d3b39c6
Please reload this pagehttps://github.com/triggerdotdev/trigger.dev/pull/3777/files
Please reload this pagehttps://github.com/triggerdotdev/trigger.dev/pull/3777/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.