Skip to content

Default transducer.buffer.size to 600; port upstream resource-param docs - #29

Merged
eagmon merged 1 commit into
mainfrom
fix/xarray-buffer-sizing
Aug 21, 2026
Merged

Default transducer.buffer.size to 600; port upstream resource-param docs#29
eagmon merged 1 commit into
mainfrom
fix/xarray-buffer-sizing

Conversation

@eagmon

@eagmon eagmon commented Aug 21, 2026

Copy link
Copy Markdown
Member

Why

The XArrayEmitter flushes its in-memory buffer to the zarr store every transducer.buffer.size emit steps. A small buffer (3–4) forces a flush every few simulated seconds, degrading write latency and compression by ~2 orders of magnitude — the transport-layer latency is designed to be 2+ orders of magnitude below the time to fill one buffer. This is the regression Boyan Beronov flagged on vEcoli PR #414 and v2ecoli #506.

What

  • buffer.size is now optional, defaulting to DEFAULT_BUFFER_SIZE = 600 — a handful of flushes per generation at 1 Hz emission (~10 min simulated time per flush), Boyan's recommended sizing. Explicit values are still validated (int > 2).
  • Ported the clarified resource-parameter docs from vEcoli PR #414 (commit febe381): the transducer.buffer.size note + example (3 → 600), and the writer.buffers_per_chunk rule of thumb (interval × size × buffers_per_chunk ≈ steps per generation; immutable object storage → 1).
  • New tests/test_xarray_buffer_default.py — default, explicit override, and rejection of invalid explicit sizes.

Verification

23/23 relevant tests pass (test_xarray_buffer_default, test_xarray_emitter, test_xarray_query_idempotent). Backward compatible: existing configs that pass buffer.size explicitly are unaffected.

🤖 Generated with Claude Code

…ort upstream resource-param docs

The XArrayEmitter's in-memory buffer flushes to the zarr store every
`transducer.buffer.size` emit steps. Sizing it small (3-4) forces a flush
every few *simulated* seconds, degrading write latency and compression by
~2 orders of magnitude, because the transport-layer latency is meant to be
2+ orders of magnitude below the time to fill one buffer.

- Make `buffer.size` optional; when omitted, default to DEFAULT_BUFFER_SIZE
  = 600 (a handful of flushes per generation at 1 Hz emission, ~10 min of
  simulated time per flush). Explicit values are still validated (int > 2).
- Port the clarified resource-parameter docs from vEcoli PR #414
  (commit febe381): the transducer buffer.size note + example (3 -> 600)
  and the writer.buffers_per_chunk rule of thumb
  (interval * size * buffers_per_chunk ~= steps per generation).
- Add tests/test_xarray_buffer_default.py covering the default, explicit
  override, and rejection of invalid explicit sizes.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant