-
Notifications
You must be signed in to change notification settings - Fork 1.2k
refactor(bigquery-jdbc): migrate metadata thread management to connection-scoped executor #13556
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
201a16b
5aa8d67
493e9c7
1babe66
45a7f4f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -362,15 +362,13 @@ public class BigQueryConnection extends BigQueryNoOpsConnection { | |
|
|
||
| this.headerProvider = createHeaderProvider(); | ||
| this.bigQuery = getBigQueryConnection(); | ||
| // Fixed thread pool queues tasks to limit concurrent metadata calls and prevent API | ||
| // throttling. | ||
| this.metadataExecutor = | ||
| BigQueryJdbcMdc.newFixedThreadPool( | ||
| String.format("BQ-Metadata-%s", connectionId), metadataFetchThreadCount); | ||
| // Cached pool executes queries immediately without queueing and reclaims all idle threads | ||
| // when inactive, minimizing resources. | ||
| this.queryExecutor = | ||
| BigQueryJdbcMdc.newCachedThreadPool(String.format("BQ-Query-%s", connectionId)); | ||
| this.metadataExecutor = | ||
| BigQueryJdbcMdc.newFixedThreadPool( | ||
| String.format("BQ-Metadata-%s", connectionId), this.metadataFetchThreadCount); | ||
|
Comment on lines
365
to
+371
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To avoid unnecessary performance and memory overhead when metadata methods are not called, initialize the References
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No |
||
| } | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why changing this to lazy init? Init is cheap & it won't start threads unless required
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking to optimize it for the cases when connections only execute SQL statements (and never run metadata queries) so it takes absolutely zero memory or object allocations for the metadata pool.
But yeah you are right, I missed
Init is cheap & it won't start threads unless required. Reverted.