pubsub: start connections slowly#2055
Merged
pongad merged 2 commits intogoogleapis:masterfrom May 17, 2017
pongad:slow-init
Merged
pubsub: start connections slowly#2055pongad merged 2 commits intogoogleapis:masterfrom pongad:slow-init
pongad merged 2 commits intogoogleapis:masterfrom
pongad:slow-init
Conversation
Starting a new connection seems to add a task which blocks a thread in our thread pool. It does not block for long, but Subscriber starts many connections, slamming the pool. If the number of threads the pool is low, the pool is blocked for a long time, causing strange delays and RPC failures. This PR alleviates this problem by starting connections one at a time. - Each connection now make one successful call before declaring itself running. - The Subscriber waits for a connection to be in running state before starting another. Together, these changes limit the number of blocking tasks registered to the pool. Since starting the Subscriber can now take a significant amount of time, and `doStart` should return promptly, a new thread is used to start up the connections.
|
Changes Unknown when pulling 4c988ec on pongad:slow-init into ** on GoogleCloudPlatform:master**. |
| notifyFailed(t); | ||
| } | ||
| } | ||
| }).start(); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Contributor
Author
|
Changes Unknown when pulling 74a7aa1 on pongad:slow-init into ** on GoogleCloudPlatform:master**. |
Contributor
|
LGTM |
pongad
added a commit
that referenced
this pull request
Jun 6, 2017
This PR undoes part of #2055. Refreshing credentials blocks thread for a period of time. Previously, each channel has its own credentials, so starting many channels spams executor with many blocking tasks. but the downside is we take a long time to fully start: about 2 minutes on my machine. Now, all connections share the same credentials, so refreshing only happens once. We can start quickly again. Also rename setLeaseAlarmsExecutorProvider, since the executor is now also used for polling.
suztomo
pushed a commit
to suztomo/google-cloud-java
that referenced
this pull request
Mar 23, 2026
meltsufin
pushed a commit
that referenced
this pull request
Apr 29, 2026
…onfig to v1.8.0 (#2055) * build(deps): update dependency com.google.cloud:google-cloud-shared-config to v1.8.0 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
meltsufin
pushed a commit
that referenced
this pull request
May 1, 2026
…onfig to v1.8.0 (#2055) * build(deps): update dependency com.google.cloud:google-cloud-shared-config to v1.8.0 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
meltsufin
pushed a commit
that referenced
this pull request
May 2, 2026
… will actually be logged (#2055)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Starting a new connection seems to add a task which blocks
a thread in our thread pool.
It does not block for long, but Subscriber starts many connections,
slamming the pool.
If the number of threads the pool is low, the pool is blocked for
a long time, causing strange delays and RPC failures.
This PR alleviates this problem by starting connections one at a time.
before starting another.
Together, these changes limit the number of blocking tasks
registered to the pool.
Since starting the Subscriber can now take a significant amount of time,
and
doStartshould return promptly,a new thread is used to start up the connections.
cc @davidtorres @saturnism