fix(collector): speed up Polymarket tape upload with zstd threads and ossutil multipart tuning - #656
Conversation
… ossutil multipart tuning Tick-level tapes (20-25 GB) were compressed with 'zstd -T1' and copied without ossutil multipart flags, capping uploads at ~50 MiB/s. - zstd thread count is configurable via ZSTD_THREADS (default 0 = auto, all cores); compression level and timeout semantics unchanged. - ossutil cp gains --parallel (OSS_PARALLEL, default 8) and --part-size (OSS_PART_SIZE, default 32Mi) on every cp invocation in the upload pipeline: upload, pre-upload existence-check download, and readback verify download. - Env values parse fail-closed through the existing env_u64/env_or helpers, and UploadConfig::validate rejects zero parallelism and an empty part size. Refs #655
📝 WalkthroughWalkthroughThe upload command now reads zstd and OSS multipart tuning from environment variables. ChangesPolymarket upload tuning
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related issues
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@rust_hft/tools/collector/src/polymarket_upload.rs`:
- Around line 129-134: Update UploadConfig::validate to parse oss_part_size
using ossutil’s canonical size suffixes, reject malformed or unsupported part
sizes, and enforce ossutil’s valid oss_parallel range before tape preparation;
update rust_hft/tools/collector/src/polymarket_upload.rs lines 2709-2711 and
2740-2817 to expect canonical suffixes instead of 32Mi/64Mi and cover invalid
and supported-edge values; update
rust_hft/tools/collector/src/bin/polymarket-raw-ops.rs lines 278-280 to use a
canonical default such as 32M.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: f5fe68b5-8c3a-4ea5-bb93-bdce30b257e5
📒 Files selected for processing (2)
rust_hft/tools/collector/src/bin/polymarket-raw-ops.rsrust_hft/tools/collector/src/polymarket_upload.rs
|
Verified on the production host |
Change contract
Make the Polymarket tape upload pipeline fast enough for tick-level tapes (20–25 GB each): zstd thread count is now configurable (
ZSTD_THREADS, default0= auto, was hardcoded-T1), and everyaliyun ossutil cpin the pipeline (upload, pre-check download, readback verify download) now carries configurable multipart tuning (OSS_PARALLEL, default8;OSS_PART_SIZE, default32Mi). Measured on the production host: default ossutil settings achieve ~50 MiB/s vs ~100+ MiB/s with--parallel 12 --part-size 32Mi; single-thread zstd was the compress-phase bottleneck under CPU quota.Issue relationship
Refs #655
Out of scope
monday-trade-data-26(separate rollout unit; code defaults already deliver the speedup, ops can setOSS_PARALLEL=12later).Dependencies and merge order
None
Focused validation
oss_upload_commandkeeps--ignore-existing, and thatUploadConfig::validate()rejectsoss_parallel = 0and a blank part size (counterexample for the new safety boundary; env parse errors fail closed via the existingenv_u64).cargo test -p hft-collector --locked: 286 passed / 0 failed (lib) plus all bin integration suites green.cargo clippy -p hft-collector --locked --all-targets: no warnings.git diff --checkclean; agent-worktree preflightverdict=ok.Rollout and rollback
No production behavior changes until a new
polymarket-raw-opsbinary is built and delivered through the collector cutover procedure; the previous binary remains available for rollback (/opt/monday/bin/polymarket-raw-ops.rollback-*). New flags are appended after positional args, matching the existing flag placement that production already runs.Scope exception
None
Summary by CodeRabbit
New Features
Bug Fixes