This repository has been archived by the owner on Nov 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
[QoS] Qos ete test #2708
Merged
Merged
[QoS] Qos ete test #2708
Changes from all commits
Commits
Show all changes
70 commits
Select commit
Hold shift + click to select a range
2e8c960
Fix SweepBatchConfig values to properly decrease to 1 with each failu…
tboam f116645
SweeperService logging improvements (#2618)
tboam c1e21ee
Refactor TracingKVS (#2643)
fsamuel-bs 53afd91
Delete docs (#2657)
hsaraogi e25d806
[20 minute tasks] Add test for when a batch is full (#2655)
tboam 88e3ffe
MetricRegistry log level downgrade + multiple timestamp tracker tests…
jeremyk-91 8b67855
Extract interface for Cassandra client (#2660)
fsamuel-bs c0c05f6
client -> namespace [no release notes] (#2654)
hsaraogi fede1c3
0.65.2 and 0.66.0 release notes (#2663)
fsamuel-bs a2be749
[QoS] Add getNamespace to AtlasDBConfig (#2661)
hsaraogi 18d35b6
Live Reloading the TimeLock Block, Part 1: Pull to Push (#2621)
jeremyk-91 a953328
Live Reloading the TimeLock Block, Part 2: TransactionManagers Plumbi…
jeremyk-91 8fdd50b
[TTT] [no release notes] Document behaviour regarding index rows (#2658)
jeremyk-91 6fed36f
Refactor and Instrument CassandraClient api (#2665)
fsamuel-bs e8e85f9
Live Reloading the TimeLock Block, Part 3: Working with 0 Nodes (#2647)
jeremyk-91 74180cf
check immutable ts (#2406)
nziebart d4bf805
Propagate top-level KVS method names to CassandraClient (#2669)
fsamuel-bs 247f60c
Extract cql executor interface (#2670)
fsamuel-bs 913e5e7
bump awaitility (#2668)
hsaraogi cafc479
Bump Atlas on Tritium 0.8.4 to fix dependency conflicts (#2662)
7fb4d17
Correctly log Paxos events (#2674)
fsamuel-bs 14216ac
Slow log and tracing (#2673)
fsamuel-bs 78791cf
Refactor cassandra client (#2676)
fsamuel-bs 22e129a
use supplier for object size [no release notes]
757a282
fix merge
a45809d
fix merge in AtlasDbConfig
e3bd685
rate limiting
dd55403
total-time
2318f69
qos config
c7dff29
respect max backoff itme
76fd664
query weights
710d216
extra tests
575b583
num rows
c9b4839
checkstyle
29ca959
fix tests
b35bb7f
no int casting
f014f56
Qos ete tests
hsaraogi 46e1308
shouldFailIfWritingTooManyBytes
hsaraogi e6035d0
fix test
hsaraogi 887aa5b
rm file
hsaraogi 3a8f467
Remove metrics
hsaraogi 08a07b2
Test shouldFailIfReadingTooManyBytes
hsaraogi da40d23
canBeWritingLargeNumberOfBytesConcurrently
hsaraogi 27073f2
checkstyle
hsaraogi 05531a1
cannotWriteLargeNumberOfBytesConcurrently
hsaraogi e370121
fix tests
hsaraogi 8eef5d5
create tm in test
hsaraogi 53f732e
More read tests (after writing a lot of data at once)
hsaraogi e2642cf
WIP
hsaraogi f1887ee
Merge branch 'feature/qos-service-api' into qos-ete-test
hsaraogi d18c007
Tests that should pas
hsaraogi fa0b731
Actually update the rate
hsaraogi 6e4745e
Add another test
hsaraogi a01eef7
More tests and address comments
hsaraogi 2aa69da
Dont extend etesetup
hsaraogi 55a82f2
Make dumping data faster
hsaraogi 2f49e0e
cleanup
hsaraogi be06b19
wip
hsaraogi d5b5a8a
Add back lost file
hsaraogi 3f080db
Cleanup
hsaraogi 504f345
Write tests
hsaraogi 59e2b6b
numReadsPerThread -> numThreads
hsaraogi 35327a9
More write tests, cleanup, check style fixes
hsaraogi b04b4fd
Refactor to avoid code duplication
hsaraogi c9ebe6e
Cleanup
hsaraogi af9d67c
cr comments
hsaraogi 6f483d9
Small read/write after a rate-limited read/write
hsaraogi dd18730
annoying no new linw at eof
hsaraogi be0759c
Uniform parameters for hard limiting
hsaraogi 304f4ed
Merge branch 'feature/qos-service-api' into qos-ete-test
hsaraogi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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
154 changes: 154 additions & 0 deletions
154
atlasdb-ete-tests/src/test/java/com/palantir/atlasdb/ete/QosCassandraEteTestSetup.java
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,154 @@ | ||
/* | ||
* Copyright 2017 Palantir Technologies, Inc. All rights reserved. | ||
* | ||
* Licensed under the BSD-3 License (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://opensource.org/licenses/BSD-3-Clause | ||
* | ||
* 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.palantir.atlasdb.ete; | ||
|
||
|
||
import java.net.InetSocketAddress; | ||
import java.util.Collections; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
import java.util.Optional; | ||
import java.util.Random; | ||
|
||
import org.awaitility.Awaitility; | ||
import org.awaitility.Duration; | ||
import org.junit.After; | ||
import org.junit.Before; | ||
import org.junit.ClassRule; | ||
|
||
import com.codahale.metrics.MetricRegistry; | ||
import com.google.common.collect.ImmutableList; | ||
import com.palantir.atlasdb.cassandra.CassandraKeyValueServiceConfig; | ||
import com.palantir.atlasdb.cassandra.ImmutableCassandraCredentialsConfig; | ||
import com.palantir.atlasdb.cassandra.ImmutableCassandraKeyValueServiceConfig; | ||
import com.palantir.atlasdb.config.AtlasDbConfig; | ||
import com.palantir.atlasdb.config.AtlasDbRuntimeConfig; | ||
import com.palantir.atlasdb.config.ImmutableAtlasDbConfig; | ||
import com.palantir.atlasdb.config.ImmutableAtlasDbRuntimeConfig; | ||
import com.palantir.atlasdb.config.ImmutableSweepConfig; | ||
import com.palantir.atlasdb.factory.TransactionManagers; | ||
import com.palantir.atlasdb.keyvalue.api.Cell; | ||
import com.palantir.atlasdb.qos.config.ImmutableQosClientConfig; | ||
import com.palantir.atlasdb.qos.config.ImmutableQosLimitsConfig; | ||
import com.palantir.atlasdb.table.description.ValueType; | ||
import com.palantir.atlasdb.todo.TodoSchema; | ||
import com.palantir.atlasdb.transaction.impl.SerializableTransactionManager; | ||
import com.palantir.atlasdb.util.AtlasDbMetrics; | ||
import com.palantir.docker.compose.DockerComposeRule; | ||
import com.palantir.docker.compose.configuration.ShutdownStrategy; | ||
import com.palantir.docker.compose.connection.Container; | ||
import com.palantir.docker.compose.connection.DockerPort; | ||
import com.palantir.docker.compose.logging.LogDirectory; | ||
import com.palantir.remoting.api.config.service.HumanReadableDuration; | ||
|
||
public class QosCassandraEteTestSetup { | ||
private static final Random random = new Random(); | ||
protected static SerializableTransactionManager serializableTransactionManager; | ||
protected static final int readBytesPerSecond = 10_000; | ||
protected static final int writeBytesPerSecond = 10_000; | ||
private static final int CASSANDRA_PORT_NUMBER = 9160; | ||
protected static final int MAX_SOFT_LIMITING_SLEEP_MILLIS = 2000; | ||
|
||
@ClassRule | ||
public static DockerComposeRule docker = DockerComposeRule.builder() | ||
.file("src/test/resources/cassandra-docker-compose.yml") | ||
.waitingForService("cassandra", Container::areAllPortsOpen) | ||
.saveLogsTo(LogDirectory.circleAwareLogDirectory(QosCassandraReadEteTest.class)) | ||
.shutdownStrategy(ShutdownStrategy.AGGRESSIVE_WITH_NETWORK_CLEANUP) | ||
.build(); | ||
|
||
@Before | ||
public void setup() { | ||
AtlasDbMetrics.setMetricRegistry(new MetricRegistry()); | ||
ensureTransactionManagerIsCreated(); | ||
} | ||
|
||
protected static void ensureTransactionManagerIsCreated() { | ||
serializableTransactionManager = TransactionManagers.builder() | ||
.config(getAtlasDbConfig()) | ||
.runtimeConfigSupplier(QosCassandraEteTestSetup::getAtlasDbRuntimeConfig) | ||
.schemas(ImmutableList.of(TodoSchema.getSchema())) | ||
.userAgent("qos-test") | ||
.buildSerializable(); | ||
|
||
Awaitility.await() | ||
.atMost(Duration.ONE_MINUTE) | ||
.pollInterval(Duration.ONE_SECOND) | ||
.until(serializableTransactionManager::isInitialized); | ||
} | ||
|
||
protected static void writeNTodosOfSize(int numTodos, int size) { | ||
serializableTransactionManager.runTaskWithRetry((transaction) -> { | ||
Map<Cell, byte[]> write = new HashMap<>(); | ||
for (int i = 0; i < numTodos; i++) { | ||
Cell thisCell = Cell.create(ValueType.FIXED_LONG.convertFromJava(random.nextLong()), | ||
TodoSchema.todoTextColumn()); | ||
write.put(thisCell, ValueType.STRING.convertFromJava(getTodoOfSize(size))); | ||
} | ||
transaction.put(TodoSchema.todoTable(), write); | ||
return null; | ||
}); | ||
} | ||
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. (as before, |
||
|
||
private static AtlasDbConfig getAtlasDbConfig() { | ||
DockerPort cassandraPort = docker.containers() | ||
.container("cassandra") | ||
.port(CASSANDRA_PORT_NUMBER); | ||
|
||
InetSocketAddress cassandraAddress = new InetSocketAddress(cassandraPort.getIp(), | ||
cassandraPort.getExternalPort()); | ||
|
||
CassandraKeyValueServiceConfig kvsConfig = ImmutableCassandraKeyValueServiceConfig.builder() | ||
.servers(ImmutableList.of(cassandraAddress)) | ||
.credentials(ImmutableCassandraCredentialsConfig.builder() | ||
.username("cassandra") | ||
.password("cassandra") | ||
.build()) | ||
.ssl(false) | ||
.replicationFactor(1) | ||
.autoRefreshNodes(false) | ||
.build(); | ||
|
||
return ImmutableAtlasDbConfig.builder() | ||
.namespace("qosete") | ||
.keyValueService(kvsConfig) | ||
.initializeAsync(true) | ||
.build(); | ||
} | ||
|
||
private static Optional<AtlasDbRuntimeConfig> getAtlasDbRuntimeConfig() { | ||
return Optional.of(ImmutableAtlasDbRuntimeConfig.builder() | ||
.sweep(ImmutableSweepConfig.builder().enabled(false).build()) | ||
.qos(ImmutableQosClientConfig.builder() | ||
.limits(ImmutableQosLimitsConfig.builder() | ||
.readBytesPerSecond(readBytesPerSecond) | ||
.writeBytesPerSecond(writeBytesPerSecond) | ||
.build()) | ||
.maxBackoffSleepTime(HumanReadableDuration.milliseconds(MAX_SOFT_LIMITING_SLEEP_MILLIS)) | ||
.build()) | ||
.build()); | ||
} | ||
|
||
private static String getTodoOfSize(int size) { | ||
// Note that the size of the cell for 1000 length text is actually 1050. | ||
return String.join("", Collections.nCopies(size, "a")); | ||
} | ||
|
||
@After | ||
public void after() { | ||
serializableTransactionManager.close(); | ||
} | ||
} |
Oops, something went wrong.
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.
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.
OK, this works. I think we probably want a comment somewhere that the runtime configuration is not actually live reloaded, in case we try to use this for live reloading.
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.
ah, i forgot about this. this is probably a requirement before shipping, since it needs to be able to be turned off live
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.
actually i think i'm referring to something different - the QosClient does not respect the live-reloadability of the QoS config
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.
yeah. There are 2 things here I guess -
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.
The
AtlasDbEteServer
does not need the live reloading as of now unless we want to test the live-reloadability here.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.
@jeremyk-91 @nziebart Just checking: are these comments now resolved elsewhere?
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.
As Himangi mentions we aren't dealing with 2 for now.
1 is done - see
QosRateLimiter
https://github.com/palantir/atlasdb/blob/feature/qos-service-api/qos-service-impl/src/main/java/com/palantir/atlasdb/qos/ratelimit/QosRateLimiter.java.Aside: the concurrency in that class feels a bit weird (I think it is correct, but could result in multiple creations on a change - though last-one-wins is probably fine), but that's not the scope of this.