Response Length Calculation
Wire format
Each server response is sent as:
4-byte big-endian length prefix + UTF-8 JSON payloadSo:
total_bytes = 4 + json_payload_bytesThe response JSON shape is:
{
"meta": ...,
"uuid": ...,
"hits": [...]
}Important behavior for return_empty
- If
hits = 0andreturn_emptyisfalseor omitted, the server sends no response - If
hits = 0andreturn_empty = true, the server sends an empty response payload
Assumptions Used For The Table
uuidexample:"generated-uuid"metaexample:
{"source":"python-client","mode":"live"}- Each returned ID is a 36-byte UUID-like string:
"123e4567-e89b-12d3-a456-426614174000"Calculation Process
Base payload sizes
1. No uuid, no meta, empty hits
{"meta":null,"uuid":null,"hits":[]}- JSON bytes:
35 - Framed bytes:
35 + 4 = 39
2. uuid only, empty hits
{"meta":null,"uuid":"generated-uuid","hits":[]}- JSON bytes:
47 - Framed bytes:
47 + 4 = 51
3. meta only, empty hits
{"meta":{"source":"python-client","mode":"live"},"uuid":null,"hits":[]}- JSON bytes:
71 - Framed bytes:
71 + 4 = 75
4. uuid + meta, empty hits
{"meta":{"source":"python-client","mode":"live"},"uuid":"generated-uuid","hits":[]}- JSON bytes:
83 - Framed bytes:
83 + 4 = 87
Per-returned-ID growth
For a 36-byte returned ID:
- First ID adds
38bytes to the JSON payload - Each additional ID adds
39bytes
Reason:
- first item:
"+ 36 chars +"=38 - next items:
,+"+ 36 chars +"=39
So for n > 0:
hits_bytes(n) = 38 + (n - 1) * 39Equivalent:
hits_bytes(n) = 39n - 1Final Formulas
Let n be the number of returned IDs.
No uuid, no meta
total_bytes = 39 + (39n - 1), for n > 0
total_bytes = 39, for n = 0Simplified:
total_bytes = 38 + 39n, for n > 0
total_bytes = 39, for n = 0uuid only
total_bytes = 51, for n = 0
total_bytes = 50 + 39n, for n > 0meta only
total_bytes = 75, for n = 0
total_bytes = 74 + 39n, for n > 0uuid + meta
total_bytes = 87, for n = 0
total_bytes = 86 + 39n, for n > 0Results Table
| Returned IDs | No uuid, No meta | uuid only | meta only | uuid + meta |
|---|---|---|---|---|
| 0 | 39 | 51 | 75 | 87 |
| 1 | 77 | 89 | 113 | 125 |
| 2 | 116 | 128 | 152 | 164 |
| 3 | 155 | 167 | 191 | 203 |
| 4 | 194 | 206 | 230 | 242 |
| 5 | 233 | 245 | 269 | 281 |
| 6 | 272 | 284 | 308 | 320 |
| 7 | 311 | 323 | 347 | 359 |
| 8 | 350 | 362 | 386 | 398 |
| 9 | 389 | 401 | 425 | 437 |
| 10 | 428 | 440 | 464 | 476 |
| 11 | 467 | 479 | 503 | 515 |
| 12 | 506 | 518 | 542 | 554 |
| 13 | 545 | 557 | 581 | 593 |
| 14 | 584 | 596 | 620 | 632 |
| 15 | 623 | 635 | 659 | 671 |
Notes
- These values are for the PBS application payload only
- They do not include TCP, IP, or TLS overhead
- If
return_empty=falseand there are0hits, response size is0 bytes