Skip to content

perf: stream discarded YCSB reads - #234

Merged
ovaistariq merged 2 commits into
mainfrom
perfloop-pr-open-6t8r6zsdwk
Aug 20, 2026
Merged

ovaistariq merged 2 commits into
mainfrom
perfloop-pr-open-6t8r6zsdwk

Conversation

@perfloop

@perfloop perfloop Bot commented Aug 20, 2026 •

Copy link
Copy Markdown
Contributor

YCSB does not consume read values. Drain reads through GetStream instead of materializing an unused result slice; the full response is still received and errors are reported.

The size threshold and --force-streaming now apply only to writes. Add a regression test that verifies every response byte is drained, plus a read-only YCSB benchmark spanning 64 KiB–1 MiB values.

Tests:

  • make fmt-check
  • make test-client

Workload: YCSB C discarded reads, 64 KiB values, 1 key, 64 operations, 4 workers, connection pool 4, NoProgress=true, ForceStreaming=false

Metric Before After Change
B/op 13234560 8195828 38.1% lower

Workload: YCSB C discarded reads, 256 KiB values, 1 key, 64 operations, 4 workers, connection pool 4, NoProgress=true, ForceStreaming=false

Metric Before After Change
ns/op 40293422 27531761 31.7% lower
MB/s 416.4 609.5 46.4% higher
B/op 76503771 23007986 69.9% lower

Workload: YCSB C discarded reads, 1 MiB values, 1 key, 64 operations, 4 workers, connection pool 4, NoProgress=true, ForceStreaming=false

Metric Before After Change
ns/op 130424435 82009536 37.1% lower
MB/s 514.6 818.3 59% higher
B/op 405060287 85267099 78.9% lower
Checks: 2 passed.

Generated by Perfloop. Measurements and checks.


Note

Cursor Bugbot is generating a summary for commit a1cacf1. Configure here.

@greptile-apps

greptile-apps Bot commented Aug 20, 2026

Copy link
Copy Markdown

Greptile Summary

This PR changes YCSB reads to stream response chunks directly into io.Discard, avoiding allocation of unused result slices while retaining complete response draining and error reporting.

  • Limits the size threshold and --force-streaming behavior to writes.
  • Updates CLI output and benchmark documentation to describe the new transport selection.
  • Adds a read-only regression test and benchmarks for values from 64 KiB through 1 MiB.

Confidence Score: 4/5

The PR appears safe to merge, with only non-blocking improvements needed in the regression test and duplicated documentation.

The streaming implementation preserves response draining and error handling, but the new test does not distinguish streaming into io.Discard from the previous buffered implementation, and the documentation repeats adjacent information.

Files Needing Attention: client/cmd/ycsb/ycsb_test.go, docs/benchmark.md

Important Files Changed

Filename Overview
client/cmd/ycsb/ycsb.go Always routes reads through GetStream with io.Discard and computes write streaming selection once per run; no behavioral defect identified.
client/cmd/ycsb/ycsb_test.go Adds a loopback gRPC fixture and read benchmarks, but its byte-count assertion cannot detect a regression back to buffered read materialization.
client/cmd/ycsb/progress_pterm.go Updates result labels to accurately distinguish always-streamed reads from conditional write streaming.
client/cmd/main.go Updates the force-streaming flag description to match its write-only effect.
docs/benchmark.md Documents the new streaming behavior but redundantly repeats the option-table semantics in an adjacent paragraph.

Reviews (1): Last reviewed commit: "perf: stream discarded YCSB reads" | Re-trigger Greptile

Comment on lines +137 to +139
if got, want := cacheServer.responseBytes.Load(), int64(cfg.NumOps*cfg.ValueSize); got != want {
t.Errorf("response bytes = %d, want %d", got, want)
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Byte count misses allocation regression

The server-side responseBytes assertion only proves that the complete response was sent. A buffered Get would consume the same bytes, so this test still passes when the result-materializing implementation—and the allocation regression this test is intended to prevent—is restored.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Comment thread docs/benchmark.md
| `--force-streaming` | Force streaming for all operations | `false` |
| `--force-streaming` | Force streaming for writes; reads always stream | `false` |

Read operations always stream their responses because the benchmark does not consume values. `--force-streaming` therefore only affects writes below the automatic streaming threshold.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Streaming semantics are duplicated

This paragraph repeats the --force-streaming behavior already stated in the immediately preceding table row, adding maintenance overhead and allowing the two descriptions to drift.

Suggested change
Read operations always stream their responses because the benchmark does not consume values. `--force-streaming` therefore only affects writes below the automatic streaming threshold.

Rule Used: Avoid adding explanatory notes that simply restate... (source)

Learned From
tigrisdata/tigris-os-docs#265

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@ovaistariq
ovaistariq merged commit d02bcb4 into main Aug 20, 2026
12 of 13 checks passed
@ovaistariq
ovaistariq deleted the perfloop-pr-open-6t8r6zsdwk branch August 20, 2026 18:02
@tigrisdata-argocd-bot

Copy link
Copy Markdown

🎉 This PR is included in version 1.12.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants