Skip to content
This repository was archived by the owner on May 8, 2026. It is now read-only.

feat: extend channel priming logic to also send fake requests - #398

Merged
kolea2 merged 8 commits into
googleapis:masterfrom
igorbernstein2:channel-priming
Sep 1, 2020
Merged

feat: extend channel priming logic to also send fake requests#398
kolea2 merged 8 commits into
googleapis:masterfrom
igorbernstein2:channel-priming

Conversation

@igorbernstein2

@igorbernstein2igorbernstein2 commented Aug 28, 2020

Copy link
Copy Markdown
Contributor

This PR upgrades the existing channel refresher to send a fake read row request to ensure that server side caches are warmed up. The new refresher will create a temporary stub around the new channel, which will reuse all of the existing request decorations (resource headers and user agent)

@igorbernstein2igorbernstein2 added the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Aug 28, 2020
@google-clagoogle-claBot added the cla: yes This human has signed the Contributor License Agreement. label Aug 28, 2020
@igorbernstein2igorbernstein2 changed the title feat: extend channel priming logic to also send fake requests [WIP]feat: extend channel priming logic to also send fake requestsAug 28, 2020
@igorbernstein2
igorbernstein2 marked this pull request as ready for review August 28, 2020 21:45
@igorbernstein2igorbernstein2 removed the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Aug 28, 2020
@product-auto-labelproduct-auto-labelBot added the api: bigtable Issues related to the googleapis/java-bigtable API. label Aug 29, 2020
@codecov

codecovBot commented Aug 31, 2020

Copy link
Copy Markdown

Codecov Report

Merging #398 into master will increase coverage by 0.11%.
The diff coverage is 84.09%.

Impacted file tree graph

@@ Coverage Diff @@## master #398 +/- ##
============================================
+ Coverage 80.24% 80.36% +0.11% - Complexity 1102 1113 +11 
============================================
Files 105 105 Lines 6815 6897 +82 Branches 364 369 +5 ============================================
+ Hits 5469 5543 +74 - Misses 1148 1155 +7 - Partials 198 199 +1 
Impacted FilesCoverage ΔComplexity Δ
...e/cloud/bigtable/data/v2/BigtableDataSettings.java63.63% <0.00%> (-4.11%)7.00 <0.00> (ø)
...d/bigtable/data/v2/stub/BigtableChannelPrimer.java78.87% <78.87%> (ø)8.00 <8.00> (?)
...ble/data/v2/stub/EnhancedBigtableStubSettings.java96.80% <85.71%> (-0.44%)22.00 <1.00> (+1.00)⬇️
...ud/bigtable/data/v2/stub/EnhancedBigtableStub.java96.05% <98.00%> (+0.31%)24.00 <4.00> (+3.00)
...d/bigtable/data/v2/stub/metrics/MetricsTracer.java81.01% <0.00%> (+2.53%)15.00% <0.00%> (+1.00%)
...ata/v2/stub/readrows/FilterMarkerRowsCallable.java96.77% <0.00%> (+12.90%)2.00% <0.00%> (ø%)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a56a0f8...5e1a94d. Read the comment docs.

throws IOException {
EnhancedBigtableStubSettings.Builder builder = settings.toBuilder();

if (settings.isRefreshingChannel()) {

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.

Can we add some tests around this to ensure the proper values are set in the settings?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

I added a test for testChannelPrimerConfigured, which should cover the behavior of it

// connections to Cloud Bigtable service
if (isRefreshingChannel) {
Preconditions.checkArgument(
getTransportChannelProvider() instanceof InstantiatingGrpcChannelProvider,

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.

should this check be moved to where we are setting the transport provider, https://github.com/googleapis/java-bigtable/pull/398/files#diff-dad9668e639c962562540f7f70a24138R144?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

No, I want the validation logic to be as close to usage as possible.

@tonytangertonytanger 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.

Channel priming logic looks good!

I'm not the most familiar with the stub and stub settings. A second opinion on that would be useful.

}
}

private void primeChannelUnsafe(ManagedChannel managedChannel) throws IOException {

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.

I'm not sure I understand why this is called unsafe?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Because it could throw an exception, does the priming api expect to handle the exceptions?

builder.setTransportChannelProvider(
transportProvider
.toBuilder()
.setChannelPrimer(

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.

It would be nice to have a comment here explaining the consequence of "setChannelPrimer" that the channel is created once, but periodically creates a new channel, runs BigtableChannelPrimer on the newly created channel and replaces the existing one with the new one.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

I dont quite follow, can you rephrase?

@kolea2
kolea2 merged commit 6f1ead2 into googleapis:masterSep 1, 2020
@igorbernstein2
igorbernstein2 deleted the channel-priming branch September 1, 2020 21:38
gcf-merge-on-greenBot pushed a commit that referenced this pull request Sep 2, 2020
🤖 I have created a release \*beep\* \*boop\* ---
## [1.15.0](https://www.github.com/googleapis/java-bigtable/compare/v1.14.0...v1.15.0) (2020-09-01)
### Features
* extend channel priming logic to also send fake requests ([#398](https://www.github.com/googleapis/java-bigtable/issues/398)) ([6f1ead2](https://www.github.com/googleapis/java-bigtable/commit/6f1ead2097150a87cb9712bcf35c6eaa9d57440c))
* **deps:** adopt flatten plugin and google-cloud-shared-dependencies ([#350](https://www.github.com/googleapis/java-bigtable/issues/350)) ([2298596](https://www.github.com/googleapis/java-bigtable/commit/2298596dab8a1ef87c0f48d3abe8bc3955417eb1))
### Bug Fixes
* temporarily disable reporting to unblock releases ([#395](https://www.github.com/googleapis/java-bigtable/issues/395)) ([a56a0f8](https://www.github.com/googleapis/java-bigtable/commit/a56a0f8c9caf675b68d02587b042e1feeb261ccb))
### Dependencies
* update dependency com.google.cloud:google-cloud-shared-dependencies to v0.8.6 ([#377](https://www.github.com/googleapis/java-bigtable/issues/377)) ([bdae336](https://www.github.com/googleapis/java-bigtable/commit/bdae336074d80815dcaaf8c71befafc0ed66c079))
* update dependency com.google.cloud:google-cloud-shared-dependencies to v0.9.0 ([#402](https://www.github.com/googleapis/java-bigtable/issues/402)) ([08f7d84](https://www.github.com/googleapis/java-bigtable/commit/08f7d84333c6a74bf03e0a57707b878a29400dd4))
---
This PR was generated with [Release Please](https://github.com/googleapis/release-please).
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

api: bigtableIssues related to the googleapis/java-bigtable API.cla: yesThis human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@igorbernstein2@tonytanger@kolea2