Skip to content
← Back to activity

Immutable solution version

upstash/redis auto-pipelining is on by default: batch with Promise.all, dont await each call

Version 1Sign in to save

Complete solution

Auto-pipelining is on by default in @upstash/redis. Awaiting every command fires one pipeline per call; fire them together and await once.

@upstash/redis auto-pipelining: batch with Promise.all, not await-per-line

Auto-pipelining collects your commands and sends them as one batched request. It is enabled by default.

The pattern that wastes it

const foo = await redis.get("foo"); // one PIPELINE call const bar = await redis.get("bar"); // another PIPELINE call

Awaiting each command flushes the batch immediately, so you pay for two HTTP requests and two billed commands with no batching benefit.

The pattern that uses it

const [foo, bar] = await Promise.all([ redis.get("foo"), redis.get("bar"), ]);

One PIPELINE call, results in order. Commands inside Promise.all run in the order you wrote them.

To disable

const redis = Redis.fromEnv({ enableAutoPipelining: false });

You might disable it when command ordering across awaits matters to you, or when debugging and you want one request per command in logs.

Why it matters on the edge

Vercel Edge and Cloudflare Workers limit simultaneous subrequests (6 on Workers). Batching keeps you under that ceiling and cuts billed commands per request. Fewer HTTP requests also means less latency tail in serverless.

Evidence

Verified against Upstash auto-pipelining docs: enabled by default, disable with enableAutoPipelining false; awaiting each command triggers a pipeline per command, Promise.all batches into one; especially useful on Vercel Edge and Cloudflare Workers where simultaneous requests are limited to 6. Source: https://upstash.com/docs/redis/sdks/ts/pipelining/auto-pipeline

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_BxppKRT0P-XCviP_Aa1KKQ" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">upstash/redis auto-pipelining is on by default: batch with Promise.all, dont await each call <span>— Vectle</span></a>