Skip to content

perf(drivers): fetch Kafka first pages per leader and reuse Cassandra prepared browses - #4349

Merged
datlechin merged 12 commits into
mainfrom
perf/driver-round-trip-retries
Nov 19, 2026
Merged

datlechin merged 12 commits into
mainfrom
perf/driver-round-trip-retries

Conversation

@datlechin

Copy link
Copy Markdown
Member

Summary

  • P26 Kafka: the first page reads every partition's first reply with one Fetch per leader, leaders in parallel, instead of one Fetch per partition in turn.
  • P26 Kafka: one byte budget per browse (64 MiB) covers every leader's request. Each request reserves its reply limit plus the one copy it is parsed into before it is sent, and keeps it until the browse ends. Up to 25 partitions share the first read; the rest read on their own as before.
  • P26 Kafka: KafkaConnection.send(_:replyLimit:) refuses a reply past its limit at the length header and skips its bytes as they arrive (KafkaFrameSplitter), so an oversized reply is never gathered and the connection stays usable. The frame is copied once into the reader instead of twice, for every request.
  • P32 Cassandra: browse pages reuse the prepared statement instead of preparing it again on every page.
  • P32 Cassandra: only a statement that names its keyspace and its columns is cached, keyed by its CQL and the driver's schema snapshot version, 16 at most. A table tab's browse is sent with its table in the session's keyspace, the one its TTLs and resume points already use. SELECT * is never cached.
  • P32 Cassandra: the driver's own keyspace switch, sent before every scoped operation, no longer clears cached statements or resume points. A USE typed in the editor, any other non-read statement and disconnect still clear them.
  • P29 BigQuery: not in this PR. The jobs.query change stays on main until Stop is reworked.

Test plan

  • TableProKafkaCoreTests: KafkaFetchWireRequestTests, KafkaFetchWireFirstReadsTests, KafkaFetchByteBudgetTests, KafkaFetchWireResponseTests, KafkaFrameSplitterTests, 73 passed.
  • TableProCassandraCoreTests: CassandraBrowseSourceTests, CassandraPreparedCacheTests, 63 passed.
  • New types, so none of these compile on main.
  • verify.sh on the last commit: generate, build, plugins, lint (13 files) PASS.
  • Not run against a real server: no Kafka broker or Cassandra cluster here. The tests cover the Fetch requests built, the replies parsed, the budget, the frame splitting and the browse shapes cached.
  • Round trips are from the code: Kafka first page 3 + P to about 4 (12 partitions: 15 to 4); Cassandra at least 1 fewer per page after the first.

@datlechin
datlechin enabled auto-merge (squash) November 19, 2026 10:26
@datlechin
datlechin merged commit ae5387d into main Nov 19, 2026
27 of 31 checks passed
@datlechin
datlechin deleted the perf/driver-round-trip-retries branch November 19, 2026 15:54
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