Skip to content

Commit 1e8caf5

Browse files
author
Andras Palinkas
committed
Merge remote-tracking branch 'origin/master' into all-sql-fn-null
2 parents baa147c + 564d757 commit 1e8caf5

File tree

169 files changed

+1410
-989
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

169 files changed

+1410
-989
lines changed

benchmarks/README.md

Lines changed: 47 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,24 @@ If you want to run a specific benchmark class like, say,
2424
`MemoryStatsBenchmark`, you can use `--args`:
2525

2626
```
27-
gradlew -p benchmarks run --args ' MemoryStatsBenchmark'
27+
gradlew -p benchmarks run --args 'MemoryStatsBenchmark'
28+
```
29+
30+
Everything in the `'` gets sent on the command line to JMH.
31+
32+
You can set benchmark parameters with `-p`:
33+
```
34+
gradlew -p benchmarks/ run --args 'RoundingBenchmark.round -prounder=es -prange="2000-10-01 to 2000-11-01" -pzone=America/New_York -pinterval=10d -pcount=1000000'
35+
```
36+
37+
The benchmark code defines default values for the parameters so if
38+
you leave out any out JMH will run with each default value, one after
39+
the other. This will run with `interval` set to `calendar year` then
40+
`calendar hour` then `10d` then `5d` then `1h`:
41+
```
42+
gradlew -p benchmarks/ run --args 'RoundingBenchmark.round -prounder=es -prange="2000-10-01 to 2000-11-01" -pzone=America/New_York -pcount=1000000'
2843
```
2944

30-
Everything in the `'` gets sent on the command line to JMH. The leading ` `
31-
inside the `'`s is important. Without it parameters are sometimes sent to
32-
gradle.
3345

3446
## Adding Microbenchmarks
3547

@@ -55,7 +67,8 @@ To get realistic results, you should exercise care when running benchmarks. Here
5567
* Use the integrated profilers in JMH to dig deeper if benchmark results to not match your hypotheses:
5668
* Add `-prof gc` to the options to check whether the garbage collector runs during a microbenchmarks and skews
5769
your results. If so, try to force a GC between runs (`-gc true`) but watch out for the caveats.
58-
* Add `-prof perf` or `-prof perfasm` (both only available on Linux) to see hotspots.
70+
* Add `-prof perf` or `-prof perfasm` (both only available on Linux, see Disassembling below) to see hotspots.
71+
* Add `-prof async` to see hotspots.
5972
* Have your benchmarks peer-reviewed.
6073

6174
### Don't
@@ -66,6 +79,8 @@ To get realistic results, you should exercise care when running benchmarks. Here
6679

6780
## Disassembling
6881

82+
NOTE: Linux only. Sorry Mac and Windows.
83+
6984
Disassembling is fun! Maybe not always useful, but always fun! Generally, you'll want to install `perf` and FCML's `hsdis`.
7085
`perf` is generally available via `apg-get install perf` or `pacman -S perf`. FCML is a little more involved. This worked
7186
on 2020-08-01:
@@ -88,3 +103,30 @@ gradlew -p benchmarks run --args ' MemoryStatsBenchmark -jvmArgs "-XX:+UnlockDia
88103
```
89104

90105
If you want `perf` to find the hot methods for you then do add `-prof:perfasm`.
106+
107+
## Async Profiler
108+
109+
Note: Linux and Mac only. Sorry Windows.
110+
111+
The async profiler is neat because it does not suffer from the safepoint
112+
bias problem. And because it makes pretty flame graphs!
113+
114+
Let user processes read performance stuff:
115+
```
116+
sudo bash
117+
echo 0 > /proc/sys/kernel/kptr_restrict
118+
echo 1 > /proc/sys/kernel/perf_event_paranoid
119+
exit
120+
```
121+
122+
Grab the async profiler from https://github.com/jvm-profiling-tools/async-profiler
123+
and run `prof async` like so:
124+
```
125+
gradlew -p benchmarks/ run --args 'LongKeyedBucketOrdsBenchmark.multiBucket -prof "async:libPath=/home/nik9000/Downloads/tmp/async-profiler-1.8.3-linux-x64/build/libasyncProfiler.so;dir=/tmp/prof;output=flamegraph"'
126+
```
127+
128+
If you are on mac this'll warn you that you downloaded the shared library from
129+
the internet. You'll need to go to settings and allow it to run.
130+
131+
The profiler tells you it'll be more accurate if you install debug symbols
132+
with the JVM. I didn't and the results looked pretty good to me. (2021-02-01)

benchmarks/build.gradle

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ archivesBaseName = 'elasticsearch-benchmarks'
2929
tasks.named("test").configure { enabled = false }
3030

3131
dependencies {
32-
api( project(":server")) {
32+
api(project(":server")) {
3333
// JMH ships with the conflicting version 4.6. This prevents us from using jopt-simple in benchmarks (which should be ok) but allows
3434
// us to invoke the JMH uberjar as usual.
3535
exclude group: 'net.sf.jopt-simple', module: 'jopt-simple'
@@ -61,12 +61,6 @@ tasks.named("dependenciesGraph").configure { enabled = false }
6161
tasks.named("thirdPartyAudit").configure {
6262
ignoreViolations(
6363
// these classes intentionally use JDK internal API (and this is ok since the project is maintained by Oracle employees)
64-
'org.openjdk.jmh.profile.AbstractHotspotProfiler',
65-
'org.openjdk.jmh.profile.HotspotThreadProfiler',
66-
'org.openjdk.jmh.profile.HotspotClassloadingProfiler',
67-
'org.openjdk.jmh.profile.HotspotCompilationProfiler',
68-
'org.openjdk.jmh.profile.HotspotMemoryProfiler',
69-
'org.openjdk.jmh.profile.HotspotRuntimeProfiler',
7064
'org.openjdk.jmh.util.Utils'
7165
)
7266
}

buildSrc/version.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ securemock = 1.2
4242
mocksocket = 1.2
4343

4444
# benchmark dependencies
45-
jmh = 1.19
45+
jmh = 1.26
4646

4747
# test dependencies
4848
# when updating this version, also update :qa:evil-tests

client/benchmark/src/main/java/org/elasticsearch/client/benchmark/AbstractBenchmark.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,10 @@ private void runBulkIndexBenchmark(String[] args) throws Exception {
7272
String indexFilePath = args[2];
7373
String indexName = args[3];
7474
String typeName = args[4];
75-
int totalDocs = Integer.valueOf(args[5]);
75+
float totalDocs = Float.valueOf(args[5]);
7676
int bulkSize = Integer.valueOf(args[6]);
7777

78-
int totalIterationCount = (int) Math.floor(totalDocs / bulkSize);
78+
int totalIterationCount = (int) Math.ceil(totalDocs / bulkSize);
7979
// consider 40% of all iterations as warmup iterations
8080
int warmupIterations = (int) (0.4d * totalIterationCount);
8181
int iterations = totalIterationCount - warmupIterations;

client/benchmark/src/main/java/org/elasticsearch/client/benchmark/ops/bulk/BulkBenchmarkTask.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ public void run() {
171171
logger.warn("Error while executing bulk request", ex);
172172
}
173173
long stop = System.nanoTime();
174-
if (iteration < warmupIterations) {
174+
if (iteration >= warmupIterations) {
175175
sampleRecorder.addSample(new Sample("bulk", start, start, stop, success));
176176
}
177177
}

docs/reference/ccr/getting-started.asciidoc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ that are periodically created in a remote cluster
6464
You can manually create follower indices to replicate specific indices on a
6565
remote cluster, or configure auto-follow patterns to replicate rolling time series indices.
6666

67+
TIP: If you want to replicate data across clusters in the cloud, you can
68+
link:{cloud}/ec-enable-ccs.html[configure remote clusters on {ess}]. Then, you
69+
can <<modules-cross-cluster-search,search across clusters>> and set up {ccr}.
70+
6771
video::https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt994089f5e841ad69/5f6265de6f40ab4648b5cf9b/ccr-setup-video-edited.mp4[width=700, height=500, options="autoplay,loop"]
6872

6973
[[ccr-getting-started-prerequisites]]

docs/reference/search/point-in-time-api.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ POST /_search <1>
4949
and {ref}/search-request-body.html#request-body-search-preference[`preference`]
5050
as these parameters are copied from the point in time.
5151
<2> The `id` parameter tells Elasticsearch to execute the request using contexts
52-
from this point int time.
52+
from this point in time.
5353
<3> The `keep_alive` parameter tells Elasticsearch how long it should extend
5454
the time to live of the point in time.
5555

docs/reference/search/search-your-data/search-across-clusters.asciidoc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ The following APIs support {ccs}:
2828

2929
To perform a {ccs}, you must have at least one remote cluster configured.
3030

31+
TIP: If you want to search across clusters in the cloud, you can
32+
link:{cloud}/ec-enable-ccs.html[configure remote clusters on {ess}]. Then, you
33+
can search across clusters and <<ccr-getting-started,set up {ccr}>>.
34+
3135
The following <<cluster-update-settings,cluster update settings>> API request
3236
adds three remote clusters:`cluster_one`, `cluster_two`, and `cluster_three`.
3337

docs/reference/snapshot-restore/apis/clean-up-repo-api.asciidoc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ POST /_snapshot/my_repository/_cleanup
3131

3232
`POST /_snapshot/<repository>/_cleanup`
3333

34+
[[clean-up-snapshot-repo-api-prereqs]]
35+
==== {api-prereq-title}
36+
37+
* If the {es} {security-features} are enabled, you must have the `manage`
38+
<<privileges-list-cluster,cluster privilege>> to use this API.
39+
3440
[[clean-up-snapshot-repo-api-desc]]
3541
==== {api-description-title}
3642

docs/reference/snapshot-restore/apis/clone-snapshot-api.asciidoc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ PUT /_snapshot/my_repository/source_snapshot/_clone/target_snapshot
2020

2121
`PUT /_snapshot/<repository>/<source_snapshot>/_clone/<target_snapshot>`
2222

23+
[[clone-snapshot-api-prereqs]]
24+
==== {api-prereq-title}
25+
26+
* If the {es} {security-features} are enabled, you must have the `manage`
27+
<<privileges-list-cluster,cluster privilege>> to use this API.
28+
2329
[[clone-snapshot-api-desc]]
2430
==== {api-description-title}
2531

0 commit comments

Comments
 (0)