Skip to content

feat(bigquery-storage): send gRPC keepalive pings by default - #18792

Open
ohmayr wants to merge 1 commit into
mainfrom
feat/bigquery-storage-read-keepalive
Open

ohmayr wants to merge 1 commit into
mainfrom
feat/bigquery-storage-read-keepalive

Conversation

@ohmayr

@ohmayr ohmayr commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Makes BigQueryReadClient send gRPC keepalive pings by default. ReadRows streams can sit idle for a long time, for example while BigQuery finishes a query job, and without pings a NAT or load balancer can drop the idle connection without telling either side. google-cloud-bigquery works around this with its own transport for Arrow query results (#18652). This moves the setting here, so every long read gets it.

  • Uses a gRPC channel with grpc.keepalive_time_ms and grpc.keepalive_timeout_ms set to 60s when no transport is passed (or transport="grpc").
  • Leaves a caller's transport instance or callable unchanged.
  • Adds unit tests for the default channel options and for caller-provided transports.

This changes the default channel for every bigquery-storage user, but normal table reads shouldn't notice: pings only go out while a call is open and the connection has been quiet for 60s (keepalive_permit_without_calls isn't set). A read on a dropped connection now fails with UNAVAILABLE after about 2 minutes instead of hanging, and ReadRowsStream already reconnects on that. google-cloud-bigtable and google-cloud-firestore already send keepalive pings by default, every 30s.

Fixes #18784

A ReadRows stream can sit idle for a long time, for example while
BigQuery finishes a query job before the first row. Without keepalive
pings, a NAT or load balancer can drop the idle connection without
telling either side.

BigQueryReadClient now uses a gRPC channel with keepalive pings when no
transport is passed. A transport passed by the caller is used as given.

Fixes #18784

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces default gRPC keepalive pings (60 seconds) for the BigQueryReadClient to prevent idle ReadRows streams from being dropped by NATs or load balancers, along with corresponding unit tests. Feedback on the changes highlights a potential issue where unconditionally appending default keepalive options could override custom user-configured channel options. It is recommended to check for existing keepalive keys in the options list before appending the defaults.

@ohmayr
ohmayr marked this pull request as ready for review October 20, 2026 20:45
@ohmayr
ohmayr requested review from a team as code owners October 20, 2026 20:45
@ohmayr
ohmayr requested review from sycai and tswast and removed request for a team and sycai October 20, 2026 20:45

@tswast tswast left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks!

This branch has not been deployed

No deployments
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.

bigquery-storage: set gRPC keepalive by default on BigQueryReadClient

2 participants