This repository has been archived by the owner on Mar 27, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement new Bigtable timeout & retry settings (#733)
* heroic-730 Implement new Bigtable timeout & retry settings Signed-off-by: Peter Kingswell <[email protected]> * heroic-733 lowered timeouts, added more block comments. - passing all tests - next is to refactor the 5 parameters into a class Signed-off-by: Peter Kingswell <[email protected]> * heroic-733 updated failing unit test Signed-off-by: Peter Kingswell <[email protected]> * heroic-733 attempting refactor connection settings into one class so that they're not repeated several times over Signed-off-by: Peter Kingswell <[email protected]> * updated timeout settings as agreed with @SergeyR on Slack * heroic-733 small settings & comment corrections Signed-off-by: Peter Kingswell <[email protected]> * heroic-733 small settings & comment corrections Signed-off-by: Peter Kingswell <[email protected]> * fixed runtime IT error in console & syntax warnings Signed-off-by: Peter Kingswell <[email protected]> * added tagValuesTruncatedSuggestMany to exercise difference between CI and localhost IT test runs where it works locally but not in CI. Signed-off-by: Peter Kingswell <[email protected]> * fixed checkstyle error. Signed-off-by: Peter Kingswell <[email protected]> * fixed checkstyle error. Signed-off-by: Peter Kingswell <[email protected]> * fixes logging in unit & integration tests. Signed-off-by: Peter Kingswell <[email protected]> * fixes inconsistent tagValuesTruncatedSuggest behaviour Signed-off-by: Peter Kingswell <[email protected]> * made the tests in *SuggestBackend*IT.java deterministic Signed-off-by: Peter Kingswell <[email protected]> * increased time available for deleteSeries() to complete down the road all tests of this kind (timer-based) will need redoing as they're lame and brittle. Signed-off-by: Peter Kingswell <[email protected]> * refactored 6 retry & timeout settings into new POD class which is then added as a field to BigtableBackend, Module etc. Signed-off-by: Peter Kingswell <[email protected]> * reduced cohesion between modules by switching implementations from MetricsConnectionSettingsModule to MetricsConnectionSettings Signed-off-by: Peter Kingswell <[email protected]> * moved MetricsConnectionSettingsModule to Bigtable module since... that's where it belongs, basically. Signed-off-by: Peter Kingswell <[email protected]> * *actually* moved MetricsConnectionSettingsModule to Bigtable module since...that's where it belongs, basically. Signed-off-by: Peter Kingswell <[email protected]> * added {@link ...} javadoc Signed-off-by: Peter Kingswell <[email protected]> * fixed comment Signed-off-by: Peter Kingswell <[email protected]> * implemented review feedback - removed useless/confusing @JSON annotations - changed fields from Integer to int - also fixed code analysis warnings * Rename .java to .kt * PR feedback - refactored POD BT Java class to Kotlin * implemented a workaround for @Inject not working as documented (seemingly) * improved comments, removed unnecessary subclass * io.grpc -> 1.35.0 & bigtable-client-core -> 1.19.0 * increasing heroic system test startup time by 30s to prevent the intermittent timeouts that are being observed. * fixed Could not find policy 'pick_first' exception. - occurred when a timeout happened - full message: java.lang.IllegalStateException: Could not find policy 'pick_first'. Make sure its implementation is either registered to LoadBalancerRegistry or included in META-INF/services/io.grpc.LoadBalancerProvider from your jar files. * adds integration test for Bigtable timeouts * report the failing test's actual content * fix testBackendTimesOutCorrectly assertion * unit test fix attempt #2 * set Google-default timeout and retry settings. tidied up docs too
- Loading branch information
Showing
37 changed files
with
1,291 additions
and
577 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,3 +40,4 @@ gradle-app.setting | |
|
||
# direnv config file - https://direnv.net/ | ||
/.envrc | ||
logs |
This file contains 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
This file contains 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
132 changes: 132 additions & 0 deletions
132
heroic-component/src/main/java/com/spotify/heroic/metric/MetricsConnectionSettings.kt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
/* | ||
* Copyright (c) 2015 Spotify AB. | ||
* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package com.spotify.heroic.metric | ||
|
||
import com.spotify.heroic.metric.consts.ApiQueryConsts | ||
import org.apache.commons.lang3.builder.ToStringBuilder | ||
import org.apache.commons.lang3.builder.ToStringStyle | ||
import java.util.* | ||
|
||
open class MetricsConnectionSettings( | ||
maxWriteBatchSize: Optional<Int>, | ||
mutateRpcTimeoutMs: Optional<Int>, | ||
readRowsRpcTimeoutMs: Optional<Int>, | ||
shortRpcTimeoutMs: Optional<Int>, | ||
maxScanTimeoutRetries: Optional<Int>, | ||
maxElapsedBackoffMs: Optional<Int> | ||
) { | ||
/** | ||
* See [ApiQueryConsts.DEFAULT_MUTATE_RPC_TIMEOUT_MS] | ||
*/ | ||
@JvmField | ||
var mutateRpcTimeoutMs: Int | ||
|
||
/** | ||
* See [ApiQueryConsts.DEFAULT_READ_ROWS_RPC_TIMEOUT_MS] | ||
*/ | ||
@JvmField | ||
var readRowsRpcTimeoutMs: Int | ||
|
||
/** | ||
* See [ApiQueryConsts.DEFAULT_SHORT_RPC_TIMEOUT_MS] | ||
*/ | ||
@JvmField | ||
var shortRpcTimeoutMs: Int | ||
|
||
/** | ||
* See [ApiQueryConsts.DEFAULT_MAX_SCAN_TIMEOUT_RETRIES] | ||
*/ | ||
@JvmField | ||
var maxScanTimeoutRetries: Int | ||
|
||
/** | ||
* See [ApiQueryConsts.DEFAULT_MAX_ELAPSED_BACKOFF_MILLIS] | ||
*/ | ||
@JvmField | ||
var maxElapsedBackoffMs: Int | ||
|
||
/** | ||
* See [MetricsConnectionSettings.DEFAULT_MUTATION_BATCH_SIZE] | ||
*/ | ||
@JvmField | ||
var maxWriteBatchSize: Int | ||
|
||
protected constructor() : this( | ||
Optional.of<Int>(MAX_MUTATION_BATCH_SIZE), | ||
Optional.of<Int>(ApiQueryConsts.DEFAULT_MUTATE_RPC_TIMEOUT_MS), | ||
Optional.of<Int>(ApiQueryConsts.DEFAULT_READ_ROWS_RPC_TIMEOUT_MS), | ||
Optional.of<Int>(ApiQueryConsts.DEFAULT_SHORT_RPC_TIMEOUT_MS), | ||
Optional.of<Int>(ApiQueryConsts.DEFAULT_MAX_SCAN_TIMEOUT_RETRIES), | ||
Optional.of<Int>(ApiQueryConsts.DEFAULT_MAX_ELAPSED_BACKOFF_MILLIS) | ||
) { | ||
} | ||
|
||
override fun toString(): String { | ||
return ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) | ||
.append("maxWriteBatchSize", maxWriteBatchSize) | ||
.append("mutateRpcTimeoutMs", mutateRpcTimeoutMs) | ||
.append("readRowsRpcTimeoutMs", readRowsRpcTimeoutMs) | ||
.append("shortRpcTimeoutMs", shortRpcTimeoutMs) | ||
.append("maxScanTimeoutRetries", maxScanTimeoutRetries) | ||
.append("maxElapsedBackoffMs", maxElapsedBackoffMs) | ||
.toString() | ||
} | ||
|
||
companion object { | ||
/** | ||
* default number of Cells for each batch mutation | ||
*/ | ||
const val DEFAULT_MUTATION_BATCH_SIZE = 1000 | ||
|
||
/** | ||
* maximum possible number of Cells for each batch mutation | ||
*/ | ||
const val MAX_MUTATION_BATCH_SIZE = 100000 | ||
|
||
/** | ||
* minimum possible number of Cells supported for each batch mutation | ||
*/ | ||
const val MIN_MUTATION_BATCH_SIZE = 10 | ||
@JvmStatic | ||
fun createDefault(): MetricsConnectionSettings { | ||
return MetricsConnectionSettings() | ||
} | ||
} | ||
|
||
init { | ||
// Basically make sure that maxWriteBatchSize, if set, is sane | ||
var maxWriteBatch = maxWriteBatchSize.orElse(DEFAULT_MUTATION_BATCH_SIZE) | ||
maxWriteBatch = maxWriteBatch.coerceAtLeast(MIN_MUTATION_BATCH_SIZE) | ||
maxWriteBatch = maxWriteBatch.coerceAtMost(MAX_MUTATION_BATCH_SIZE) | ||
this.maxWriteBatchSize = maxWriteBatch | ||
|
||
this.mutateRpcTimeoutMs = | ||
mutateRpcTimeoutMs.orElse(ApiQueryConsts.DEFAULT_MUTATE_RPC_TIMEOUT_MS) | ||
this.readRowsRpcTimeoutMs = | ||
readRowsRpcTimeoutMs.orElse(ApiQueryConsts.DEFAULT_READ_ROWS_RPC_TIMEOUT_MS) | ||
this.shortRpcTimeoutMs = | ||
shortRpcTimeoutMs.orElse(ApiQueryConsts.DEFAULT_SHORT_RPC_TIMEOUT_MS) | ||
this.maxScanTimeoutRetries = | ||
maxScanTimeoutRetries.orElse(ApiQueryConsts.DEFAULT_MAX_SCAN_TIMEOUT_RETRIES) | ||
this.maxElapsedBackoffMs = | ||
maxElapsedBackoffMs.orElse(ApiQueryConsts.DEFAULT_MAX_ELAPSED_BACKOFF_MILLIS) | ||
} | ||
} |
Oops, something went wrong.