-
Notifications
You must be signed in to change notification settings - Fork 182
Add optional writeToStreamMulti function to the World interface
#867
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add optional writeToStreamMulti function to the World interface
#867
Conversation
🦋 Changeset detectedLatest commit: 4d74746 The changes in this PR will be included in the next version bump. This PR includes changesets to release 17 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
🧪 E2E Test Results❌ Some tests failed Summary
❌ Failed Tests🌍 Community Worlds (161 failed)mongodb (40 failed):
redis (40 failed):
starter (41 failed):
turso (40 failed):
Details by Category✅ ▲ Vercel Production
✅ 💻 Local Development
✅ 📦 Local Production
✅ 🐘 Local Postgres
✅ 🪟 Windows
❌ 🌍 Community Worlds
✅ 📋 Other
|
📊 Benchmark Results
workflow with no steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express workflow with 1 step💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express workflow with 10 sequential steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express Promise.all with 10 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express Promise.all with 25 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express Promise.race with 10 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express Promise.race with 25 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express Stream Benchmarks (includes TTFB metrics)workflow with stream💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express SummaryFastest Framework by WorldWinner determined by most benchmark wins
Fastest World by FrameworkWinner determined by most benchmark wins
Column Definitions
Worlds:
|

Added an optional
writeToStreamMultifunction to the World interface to optimize batch writing of multiple chunks to a stream.This is an alternative solution to the issue reported in #764.
What changed?
writeToStreamMultimethod to theStreamerinterface in the World APIWorkflowServerWritableStreamto batch chunks before flushingwriteToStreamMultiin all world providers:world-local: Writes multiple chunks in parallel while preserving orderworld-postgres: Performs a batch insert for all chunksworld-vercel: Encodes multiple chunks into a length-prefixed binary formatSTREAM_FLUSH_INTERVAL_MS(10ms) to control buffer flush timingWhy make this change?
This optimization reduces network overhead when writing many small chunks to a stream by batching them together. This is particularly beneficial for:
The implementation gracefully falls back to sequential writes for world implementations that don't support the new method.