-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Introduce repository test kit/analyser #67247
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 13 commits
5ddd2db
6dc193c
5f48376
6a9aea7
d96d5ad
b744d9e
0e904d8
e32a377
c237aa5
36a6e52
280f982
64c220d
29f5d50
75705ec
7180045
0b78fe4
40e7e74
8db0096
24d7392
2f3094b
cbe503b
fbb0ed8
32169f4
452968a
6076d34
a50c0d1
4b6d53b
2263d9f
6662e1c
7b3dabe
9ecfe46
c4c3cfa
d433948
bff99a0
59ff6ec
b200616
28b488b
b383325
bda3abc
622fe24
a5ee4ca
032a3a6
4cae510
12ccaba
6308ccc
f10e51c
ffee1a7
b3c6bee
d0887fa
505d8f0
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 |
---|---|---|
@@ -0,0 +1,127 @@ | ||
[role="xpack"] | ||
[[repo-speed-test-api]] | ||
=== Repository speed test API | ||
++++ | ||
<titleabbrev>Repository speed test</titleabbrev> | ||
++++ | ||
|
||
Measures the performance characteristics of a snapshot repository. | ||
|
||
//// | ||
[source,console] | ||
---- | ||
PUT /_snapshot/my_repository | ||
{ | ||
"type": "fs", | ||
"settings": { | ||
"location": "my_backup_location" | ||
} | ||
} | ||
---- | ||
// TESTSETUP | ||
//// | ||
|
||
[source,console] | ||
---- | ||
POST /_snapshot/my_repository/_speed_test?blob_count=10&concurrency=4&max_blob_size=1mb&timeout=120s | ||
---- | ||
|
||
[[repo-speed-test-api-request]] | ||
==== {api-request-title} | ||
|
||
`POST /_snapshot/<repository>/_speed_test` | ||
|
||
[[repo-speed-test-api-desc]] | ||
==== {api-description-title} | ||
|
||
There are a large number of third-party storage systems available, not all of | ||
which are suitable for use as a snapshot repository by {es}. Some storage | ||
systems perform poorly, or behave incorrectly, especially when accessed | ||
concurrently by multiple clients as the nodes of an {es} cluster do. | ||
|
||
The Repository speed test API performs a collection of read and write | ||
operations on your repository which are specially designed to detect incorrect | ||
behaviour and to measure the performance characteristics of your storage | ||
system. | ||
|
||
Each speed test runs a wide variety of operations generated by a pseudo-random | ||
process. You can seed this process using the optional `seed` parameter in order | ||
to repeat the same set of operations in multiple experiments. Note that the | ||
operations are performed concurrently so may not always happen in the same | ||
order on each run. | ||
|
||
The default values for the parameters to this API are deliberately low to | ||
reduce the impact of running this API accidentally. A realistic experiment | ||
should set `blob_count` to at least `2000` and `max_blob_size` to at least | ||
`2gb`, and will almost certainly need to increase the `timeout` to allow time | ||
for the process to complete successfully. | ||
|
||
If the speed test is successful this API returns details of the testing | ||
process, including how long each operation took. You can use this information | ||
to analyse the performance of your storage system. If any operation fails or | ||
returns an incorrect result, this API returns an error. If the API returns an | ||
error then it may not have removed all the data it wrote to the repository. The | ||
error will indicate the location of any leftover data, and this path is also | ||
recorded in the {es} logs. You should verify yourself that this location has | ||
been cleaned up correctly. If there is still leftover data at the specified | ||
location then you should manually remove it. | ||
|
||
If the connection from your client to {es} is closed while the client is | ||
waiting for the result of the speed test then the test is cancelled. Since a | ||
speed test takes a long time to complete, you may need to configure your client | ||
to wait for longer than usual for a response. On cancellation the speed test | ||
attempts to clean up the data it was writing, but it may not be able to remove | ||
it all. The path to the leftover data is recorded in the {es} logs. You should | ||
verify yourself that this location has been cleaned up correctly. If there is | ||
still leftover data at the specified location then you should manually remove | ||
it. | ||
|
||
NOTE: A speed test writes a substantial amount of data to your repository and | ||
then reads it back again. This consumes bandwidth on the network between the | ||
cluster and the repository, and storage space and IO bandwidth on the | ||
repository itself. You must ensure this load does not affect other users of | ||
these systems. Speed tests respect the repository settings | ||
`max_snapshot_bytes_per_sec` and `max_restore_bytes_per_sec` if available, and | ||
the cluster setting `indices.recovery.max_bytes_per_sec` which you can use to | ||
limit the bandwidth they consume. | ||
|
||
[[repo-speed-test-api-path-params]] | ||
==== {api-path-parms-title} | ||
|
||
`<repository>`:: | ||
(Required, string) | ||
Name of the snapshot repository to test. | ||
|
||
[[repo-speed-test-api-query-params]] | ||
==== {api-query-parms-title} | ||
|
||
`blob_count`:: | ||
(Optional, integer) The total number of blobs to write to the repository during | ||
the test. Defaults to `100`. For realistic experiments you should set this to | ||
at least `2000`. | ||
|
||
`concurrency`:: | ||
(Optional, integer) The number of write operations to perform concurrently. | ||
Defaults to `10`. | ||
|
||
`seed`:: | ||
(Optional, integer) The seed for the pseudo-random number generator used to | ||
generate the list of operations performed during the test. To repeat the same | ||
set of operations in multiple experiments, use the same seed in each | ||
experiment. | ||
|
||
`max_blob_size`:: | ||
(Optional, <<size-units, size units>>) The maximum size of a blob to be written | ||
during the test. Defaults to `10mb`. For realistic experiments you should set | ||
this to at least `2gb`. | ||
|
||
`timeout`:: | ||
(Optional, <<time-units, time units>>) Specifies the period of time to wait for | ||
the test to complete. If no response is received before the timeout expires, | ||
the test is cancelled and returns an error. Defaults to `30s`. | ||
|
||
[role="child_attributes"] | ||
[[repo-speed-test-api-response-body]] | ||
==== {api-response-body-title} | ||
|
||
TODO | ||
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. Today we report the details of every read and write performed during the test. It'd probably be useful to add some higher-level summary statistics too, maybe only returning the low-level ones if 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. Added simple accumulators in 0e904d8. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
apply plugin: 'elasticsearch.internal-cluster-test' | ||
apply plugin: 'elasticsearch.esplugin' | ||
esplugin { | ||
name 'snapshot-repo-test-kit' | ||
description 'A plugin for a test kit for snapshot repositories' | ||
classname 'org.elasticsearch.repositories.blobstore.testkit.SnapshotRepositoryTestKit' | ||
extendedPlugins = ['x-pack-core'] | ||
} | ||
archivesBaseName = 'x-pack-snapshot-repo-test-kit' | ||
|
||
dependencies { | ||
compileOnly project(path: xpackModule('core'), configuration: 'default') | ||
internalClusterTestImplementation project(path: xpackModule('core'), configuration: 'testArtifacts') | ||
} | ||
|
||
addQaCheckDependencies() | ||
|
||
configurations { | ||
testArtifacts.extendsFrom testRuntime | ||
testArtifacts.extendsFrom testImplementation | ||
} | ||
|
||
def testJar = tasks.register("testJar", Jar) { | ||
appendix 'test' | ||
from sourceSets.test.output | ||
} | ||
|
||
artifacts { | ||
testArtifacts testJar | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
apply plugin: 'elasticsearch.build' | ||
tasks.named("test").configure { enabled = false } | ||
|
||
dependencies { | ||
api project(':test:framework') | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
apply plugin: 'elasticsearch.testclusters' | ||
apply plugin: 'elasticsearch.standalone-rest-test' | ||
apply plugin: 'elasticsearch.rest-test' | ||
apply plugin: 'elasticsearch.rest-resources' | ||
|
||
dependencies { | ||
testImplementation project(path: xpackModule('snapshot-repo-test-kit'), configuration: 'testArtifacts') | ||
} | ||
|
||
final File repoDir = file("$buildDir/testclusters/repo") | ||
DaveCTurner marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
tasks.named("integTest").configure { | ||
systemProperty 'tests.path.repo', repoDir | ||
} | ||
|
||
testClusters.matching { it.name == "integTest" }.configureEach { | ||
testDistribution = 'DEFAULT' | ||
setting 'path.repo', repoDir.absolutePath | ||
} | ||
|
||
restResources { | ||
restApi { | ||
includeCore 'indices', 'search', 'bulk', 'snapshot', 'nodes', '_common' | ||
includeXpack 'snapshot_repo_test_kit' | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
package org.elasticsearch.repositories.blobstore.testkit.rest; | ||
|
||
import org.elasticsearch.common.settings.Settings; | ||
import org.elasticsearch.repositories.blobstore.testkit.AbstractSnapshotRepoTestKitRestTestCase; | ||
import org.elasticsearch.repositories.fs.FsRepository; | ||
|
||
public class FsSnapshotRepoTestKitIT extends AbstractSnapshotRepoTestKitRestTestCase { | ||
|
||
@Override | ||
protected String repositoryType() { | ||
return FsRepository.TYPE; | ||
} | ||
|
||
@Override | ||
protected Settings repositorySettings() { | ||
return Settings.builder().put("location", System.getProperty("tests.path.repo")).build(); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
package org.elasticsearch.repositories.blobstore.testkit.rest; | ||
|
||
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory; | ||
import org.elasticsearch.test.rest.yaml.ClientYamlTestCandidate; | ||
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase; | ||
|
||
public class SnapshotRepoTestKitClientYamlTestSuiteIT extends ESClientYamlSuiteTestCase { | ||
|
||
public SnapshotRepoTestKitClientYamlTestSuiteIT(final ClientYamlTestCandidate testCandidate) { | ||
super(testCandidate); | ||
} | ||
|
||
@ParametersFactory | ||
public static Iterable<Object[]> parameters() throws Exception { | ||
return ESClientYamlSuiteTestCase.createParameters(); | ||
} | ||
} |
Uh oh!
There was an error while loading. Please reload this page.