Batch API request packing calculator

Packs consecutive records without reordering using the next-fit rule.

Your inputs

Separate numbers with commas or spaces.
Input format

Use this format with your own values:

200,200,400,100

Use the units shown.

Request count
2
Inclusive record ranges
1–2, 3–4
Request sizes (bytes)
450, 550

Your calculation
How is this calculated?

Scan records in order, starting a new request when adding a record would exceed either cap.

Report the first and last 1-based record index in each request.

Envelope bytes plus all serialized record bytes in each request.

Packs consecutive records without reordering using the next-fit rule. Each record size must include its serialization separators; the envelope is added once per request. This feasible packing is not an optimal reordering solver.

OpenStax: percentages and proportions ↗

Try an example

Worked example

Request count: 2

Inputs
  • Serialized bytes per record in order: 200,200,400,100
  • Maximum records per request: 2
  • Maximum request bytes: 600
  • Fixed envelope bytes per request: 50

Compare inputs

Request count: 1

Inputs
  • Serialized bytes per record in order: 10,10,10
  • Maximum records per request: 3
  • Maximum request bytes: 40
  • Fixed envelope bytes per request: 10
Share this page
Share this calculator

Leave unchecked to share the page without your entered values.