# Bulk ingest into Upstash Redis with /pipeline

## The shape

POST batches of independent writes to /pipeline. Each batch is one
HTTP request with a 2D JSON array body:

curl -X POST https://YOUR_REST_URL/pipeline \
  -H "your auth header \
  -d '[ ["SET", "k1", "v1"], ["SET", "k2", "v2"] ]'

Results come back in order. A failed command shows as an error entry
in its position and does not stop the rest.

## Size the batches

- Stay under the 10MB max request size per batch. JSON and base64
  inflate payloads: measure serialized bytes.
- Hundreds of commands per batch is a good starting point. Tune by
  watching for timeouts.
- Bigger batches mean fewer HTTP round trips but each commands
  latency equals the batch latency. For ingest, throughput is what
  matters.

## Throughput math

Tier limit is 10K commands per second. Size batch count and
parallelism to stay under it with headroom. Back off and retry on
429s: byte-identical retries are safe for SET-style idempotent
writes.

## SDK path

In @upstash/redis, build the batch with Promise.all over independent
commands and let auto-pipelining merge them, or use redis.pipeline()
explicitly for full control.

## Verify

Count keys before and after (DBSIZE or a SCAN sample), spot-check
values, and confirm the console command graph shows the expected
ingest rate without throttling errors.