You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 6, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Mar 6, 2026. It is now read-only.
api: bigqueryIssues related to the googleapis/python-bigquery API.priority: p3Desirable enhancement or fix. May not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
After troubleshooting for a long while on why my pandas read_gbq() (with bqstoarage_api enabled) query read request data throughput would drop like a rock early on in the download, I think I eventually found my answer.
Looking at the GCP API monitor, I saw that my requests would eventually error out in a 499 response message (client error).
I believe that for massive query results and a (max_stream_count=requested_streams) value of 0, the BQ server returns with its max stream count of 1000 streams to use. This most likely overwhelms a system and causes some of the threads to die due to timeout connections or something like that. I found that when I forced the stream number to be much more reasonable, like 48 that my download worked fine.
The other option here is something like a bag of tasks where we bound concurrent work via semaphore but still allow for a large number of streams. It requires more concurrency coordination which admittedly isn't python's strong suit, but it would prevent overwhelming the client.
Maybe instead of trying to guess the max concurrent stream that a system can support, it's simpler to just let user overwrite the max_stream_count when the default 0 doesn't work for them.
api: bigqueryIssues related to the googleapis/python-bigquery API.priority: p3Desirable enhancement or fix. May not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
Activity
tswast commentedon Jun 22, 2022
I wonder if removing the default pool size would be a sufficient fix?
python-bigquery/google/cloud/bigquery/_pandas_helpers.py
Line 873 in e760d1b
Alternatively (preferably?) we could set
requested_streamstomax(requested_streams, some multiple of the number of available cores)python-bigquery/google/cloud/bigquery/_pandas_helpers.py
Line 824 in e760d1b
shollyman commentedon Jan 25, 2023
The other option here is something like a bag of tasks where we bound concurrent work via semaphore but still allow for a large number of streams. It requires more concurrency coordination which admittedly isn't python's strong suit, but it would prevent overwhelming the client.
kien-truong commentedon Oct 3, 2024
Maybe instead of trying to guess the max concurrent stream that a system can support, it's simpler to just let user overwrite the
max_stream_countwhen the default0doesn't work for them.#2030
chalmerlowe commentedon Nov 25, 2024
Closed via PR #2039 and PR #2051.