Skip to content

Commit 6a3a4fd

Browse files
Merge branch 'main' into semantic-text_oom-circuit-breaker
2 parents ecb8e02 + 4b2867a commit 6a3a4fd

File tree

359 files changed

+5315
-5639
lines changed

Some content is hidden

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

359 files changed

+5315
-5639
lines changed

.buildkite/pipelines/pull-request/build-benchmark.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,19 @@ steps:
77
command: |
88
.ci/scripts/run-gradle.sh :build-tools-internal:bootstrapPerformanceTests
99
.ci/scripts/install-gradle-profiler.sh
10-
.ci/scripts/run-gradle-profiler.sh --benchmark --scenario-file build-tools-internal/build/performanceTests/elasticsearch-build-benchmark-{{matrix.part}}.scenarios --project-dir . --output-dir profile-out
11-
mkdir build
12-
tar -czf build/$BUILDKITE_BUILD_NUMBER.tar.bz2 profile-out
10+
.ci/scripts/run-gradle-profiler.sh --benchmark --scenario-file build-tools-internal/build/performanceTests/elasticsearch-{{matrix.part}}.scenarios --measure-config-time --project-dir . --output-dir profile-out
11+
mkdir -p build
12+
buildkite-agent artifact upload "profile-out/*"
13+
cat << EOF | buildkite-agent annotate --style "info"
14+
Benchmark Html Report <a href="artifact://profile-out/benchmark.html">Benchmark Html Report</a>
15+
EOF
1316
matrix:
1417
setup:
1518
part:
16-
- part1
17-
- part2
19+
- esql-tests
1820
env:
1921
BUILD_PERFORMANCE_TEST: "true"
22+
2023
agents:
2124
provider: gcp
2225
image: family/elasticsearch-ubuntu-2004

.ci/scripts/install-gradle-profiler.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
set -e
44
# profiler version we wanna install
5-
PROFILER_VERSION="0.16.0"
6-
wget https://repo.gradle.org/gradle/ext-releases-local/org/gradle/profiler/gradle-profiler/$PROFILER_VERSION/gradle-profiler-$PROFILER_VERSION.zip -O $WORKSPACE/gradle-profiler-$PROFILER_VERSION.zip
5+
PROFILER_VERSION="0.22.0"
6+
wget https://repo1.maven.org/maven2/org/gradle/profiler/gradle-profiler/$PROFILER_VERSION/gradle-profiler-$PROFILER_VERSION.zip -O $WORKSPACE/gradle-profiler-$PROFILER_VERSION.zip
77
unzip $WORKSPACE/gradle-profiler-$PROFILER_VERSION.zip
88
mv $WORKSPACE/gradle-profiler-$PROFILER_VERSION $WORKSPACE/gradle-profiler

benchmarks/README.md

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,19 +82,21 @@ To get realistic results, you should exercise care when running benchmarks. Here
8282
NOTE: Linux only. Sorry Mac and Windows.
8383

8484
Disassembling is fun! Maybe not always useful, but always fun! Generally, you'll want to install `perf` and the JDK's `hsdis`.
85-
`perf` is generally available via `apg-get install perf` or `pacman -S perf`. `hsdis` you'll want to compile from source. is a little more involved. This worked
85+
`perf` is generally available via `apg-get install perf` or `pacman -S perf linux-tools`. `hsdis` you'll want to compile from source. is a little more involved. This worked
8686
on 2020-08-01:
8787

8888
```
8989
git clone [email protected]:openjdk/jdk.git
9090
cd jdk
91-
git checkout jdk-17-ga
92-
cd src/utils/hsdis
91+
git checkout jdk-24-ga
9392
# Get a known good binutils
9493
wget https://ftp.gnu.org/gnu/binutils/binutils-2.35.tar.gz
9594
tar xf binutils-2.35.tar.gz
96-
make BINUTILS=binutils-2.35 ARCH=amd64
97-
sudo cp build/linux-amd64/hsdis-amd64.so /usr/lib/jvm/java-17-openjdk/lib/server/
95+
bash configure --with-hsdis=binutils --with-binutils-src=binutils-2.35 \
96+
--with-boot-jdk=~/.gradle/jdks/oracle_corporation-24-amd64-linux.2
97+
make build-hsdis
98+
cp ./build/linux-x86_64-server-release/jdk/lib/hsdis-amd64.so \
99+
~/.gradle/jdks/oracle_corporation-24-amd64-linux.2/lib/hsdis.so
98100
```
99101

100102
If you want to disassemble a single method do something like this:
@@ -105,6 +107,30 @@ gradlew -p benchmarks run --args ' MemoryStatsBenchmark -jvmArgs "-XX:+UnlockDia
105107

106108
If you want `perf` to find the hot methods for you, then do add `-prof perfasm`.
107109

110+
NOTE: `perfasm` will need more access:
111+
```
112+
sudo bash
113+
echo -1 > /proc/sys/kernel/perf_event_paranoid
114+
exit
115+
```
116+
117+
If you get warnings like:
118+
```
119+
The perf event count is suspiciously low (0).
120+
```
121+
then check if you are bumping into [this](https://man.archlinux.org/man/perf-stat.1.en#INTEL_HYBRID_SUPPORT)
122+
by running:
123+
```
124+
perf stat -B dd if=/dev/zero of=/dev/null count=1000000
125+
```
126+
127+
If you see lines like:
128+
```
129+
765019980 cpu_atom/cycles/ # 1.728 GHz (0.60%)
130+
2258845959 cpu_core/cycles/ # 5.103 GHz (99.18%)
131+
```
132+
then `perf` is just not going to work for you.
133+
108134
## Async Profiler
109135

110136
Note: Linux and Mac only. Sorry Windows.
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the "Elastic License
4+
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
5+
* Public License v 1"; you may not use this file except in compliance with, at
6+
* your election, the "Elastic License 2.0", the "GNU Affero General Public
7+
* License v3.0 only", or the "Server Side Public License, v 1".
8+
*/
9+
10+
package org.elasticsearch.benchmark.compute.operator;
11+
12+
import org.apache.lucene.document.InetAddressPoint;
13+
import org.apache.lucene.util.BytesRef;
14+
import org.elasticsearch.common.breaker.NoopCircuitBreaker;
15+
import org.elasticsearch.common.network.InetAddresses;
16+
import org.elasticsearch.compute.operator.BreakingBytesRefBuilder;
17+
import org.elasticsearch.xpack.esql.expression.function.scalar.convert.ParseIp;
18+
import org.openjdk.jmh.annotations.Benchmark;
19+
import org.openjdk.jmh.annotations.BenchmarkMode;
20+
import org.openjdk.jmh.annotations.Fork;
21+
import org.openjdk.jmh.annotations.Measurement;
22+
import org.openjdk.jmh.annotations.Mode;
23+
import org.openjdk.jmh.annotations.OutputTimeUnit;
24+
import org.openjdk.jmh.annotations.Scope;
25+
import org.openjdk.jmh.annotations.State;
26+
import org.openjdk.jmh.annotations.Warmup;
27+
28+
import java.net.InetAddress;
29+
import java.util.concurrent.TimeUnit;
30+
31+
@Warmup(iterations = 5)
32+
@Measurement(iterations = 7)
33+
@BenchmarkMode(Mode.AverageTime)
34+
@OutputTimeUnit(TimeUnit.NANOSECONDS)
35+
@State(Scope.Thread)
36+
@Fork(1)
37+
public class ParseIpBenchmark {
38+
private final BytesRef ip = new BytesRef("192.168.0.1");
39+
private final BreakingBytesRefBuilder scratch = ParseIp.buildScratch(new NoopCircuitBreaker("request"));
40+
41+
@Benchmark
42+
public BytesRef leadingZerosRejected() {
43+
return ParseIp.leadingZerosRejected(ip, scratch);
44+
}
45+
46+
@Benchmark
47+
public BytesRef leadingZerosAreDecimal() {
48+
return ParseIp.leadingZerosAreDecimal(ip, scratch);
49+
}
50+
51+
@Benchmark
52+
public BytesRef leadingZerosAreOctal() {
53+
return ParseIp.leadingZerosAreOctal(ip, scratch);
54+
}
55+
56+
@Benchmark
57+
public BytesRef original() {
58+
InetAddress inetAddress = InetAddresses.forString(ip.utf8ToString());
59+
return new BytesRef(InetAddressPoint.encode(inetAddress));
60+
}
61+
}

build-tools-internal/performance/elasticsearch-build-benchmark-part1.scenarios

Lines changed: 0 additions & 72 deletions
This file was deleted.

build-tools-internal/performance/elasticsearch-build-benchmark-part2.scenarios

Lines changed: 0 additions & 38 deletions
This file was deleted.
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
default-scenarios = ["TEST_ESQL_ABI_CHANGE_TAPI", TEST_ESQL_ABI_CHANGE_TAPI_MAIN, "TEST_ESQL_ABI_CHANGE_TAPI_CC", "TEST_ESQL_ABI_CHANGE_TAPI_CC_NOINIT", "TEST_ESQL_ABI_CHANGE_TAPI_CC_MAIN", "TEST_ESQL_ABI_CHANGE_TAPI_CC_NOINIT_MAIN"]
2+
3+
TEST_ESQL_ABI_CHANGE_TAPI {
4+
apply-abi-change-to = "x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/ColumnInfoImpl.java"
5+
tasks = [":x-pack:plugin:esql:test", "--tests", "org.elasticsearch.gradle.benchmarking.BenchmarkingTests"]
6+
gradle-args = ["-I", ".ci/init.gradle"]
7+
run-using = tooling-api // value can be "cli" or "tooling-api"
8+
daemon = warm // value can be "warm", "cold", or "none"
9+
copy-file = {
10+
source = "build-tools-internal/performance/test-files/BenchmarkingTests.java"
11+
target = "x-pack/plugin/esql/src/test/java/org/elasticsearch/gradle/benchmarking/BenchmarkingTests.java"
12+
schedule = SCENARIO
13+
}
14+
git-checkout = {
15+
cleanup = "@testGitCommit@"
16+
build = "@testGitCommit@"
17+
}
18+
warm-ups = 3
19+
iterations = 10
20+
}
21+
22+
TEST_ESQL_ABI_CHANGE_TAPI_CC {
23+
apply-abi-change-to = "x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/ColumnInfoImpl.java"
24+
tasks = [":x-pack:plugin:esql:test", "--tests", "org.elasticsearch.gradle.benchmarking.BenchmarkingTests"]
25+
gradle-args = ["--configuration-cache", "-I", ".ci/init.gradle"]
26+
run-using = tooling-api // value can be "cli" or "tooling-api"
27+
daemon = warm // value can be "warm", "cold", or "none"
28+
copy-file = {
29+
source = "build-tools-internal/performance/test-files/BenchmarkingTests.java"
30+
target = "x-pack/plugin/esql/src/test/java/org/elasticsearch/gradle/benchmarking/BenchmarkingTests.java"
31+
schedule = SCENARIO
32+
}
33+
34+
git-checkout = {
35+
cleanup = "@testGitCommit@"
36+
build = "@testGitCommit@"
37+
}
38+
warm-ups = 3
39+
iterations = 10
40+
}
41+
42+
TEST_ESQL_ABI_CHANGE_TAPI_CC_NOINIT {
43+
apply-abi-change-to = "x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/ColumnInfoImpl.java"
44+
tasks = [":x-pack:plugin:esql:test", "--tests", "org.elasticsearch.gradle.benchmarking.BenchmarkingTests"]
45+
gradle-args = ["--configuration-cache"]
46+
run-using = tooling-api // value can be "cli" or "tooling-api"
47+
daemon = warm // value can be "warm", "cold", or "none"
48+
copy-file = {
49+
source = "build-tools-internal/performance/test-files/BenchmarkingTests.java"
50+
target = "x-pack/plugin/esql/src/test/java/org/elasticsearch/gradle/benchmarking/BenchmarkingTests.java"
51+
schedule = SCENARIO
52+
}
53+
54+
git-checkout = {
55+
cleanup = "@testGitCommit@"
56+
build = "@testGitCommit@"
57+
}
58+
warm-ups = 3
59+
iterations = 10
60+
}
61+
62+
TEST_ESQL_ABI_CHANGE_TAPI_MAIN {
63+
apply-abi-change-to = "x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/ColumnInfoImpl.java"
64+
tasks = [":x-pack:plugin:esql:test", "--tests", "org.elasticsearch.gradle.benchmarking.BenchmarkingTests"]
65+
gradle-args = ["-I", ".ci/init.gradle"]
66+
run-using = tooling-api // value can be "cli" or "tooling-api"
67+
daemon = warm // value can be "warm", "cold", or "none"
68+
copy-file = {
69+
source = "build-tools-internal/performance/test-files/BenchmarkingTests.java"
70+
target = "x-pack/plugin/esql/src/test/java/org/elasticsearch/gradle/benchmarking/BenchmarkingTests.java"
71+
schedule = SCENARIO
72+
}
73+
git-checkout = {
74+
cleanup = "main"
75+
build = "main"
76+
}
77+
warm-ups = 3
78+
iterations = 10
79+
}
80+
81+
TEST_ESQL_ABI_CHANGE_TAPI_CC_MAIN {
82+
apply-abi-change-to = "x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/ColumnInfoImpl.java"
83+
tasks = [":x-pack:plugin:esql:test", "--tests", "org.elasticsearch.gradle.benchmarking.BenchmarkingTests"]
84+
gradle-args = ["--configuration-cache", "-I", ".ci/init.gradle"]
85+
run-using = tooling-api // value can be "cli" or "tooling-api"
86+
daemon = warm // value can be "warm", "cold", or "none"
87+
copy-file = {
88+
source = "build-tools-internal/performance/test-files/BenchmarkingTests.java"
89+
target = "x-pack/plugin/esql/src/test/java/org/elasticsearch/gradle/benchmarking/BenchmarkingTests.java"
90+
schedule = SCENARIO
91+
}
92+
93+
git-checkout = {
94+
cleanup = "main"
95+
build = "main"
96+
}
97+
warm-ups = 3
98+
iterations = 10
99+
}
100+
101+
TEST_ESQL_ABI_CHANGE_TAPI_CC_NOINIT_MAIN {
102+
apply-abi-change-to = "x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/ColumnInfoImpl.java"
103+
tasks = [":x-pack:plugin:esql:test", "--tests", "org.elasticsearch.gradle.benchmarking.BenchmarkingTests"]
104+
gradle-args = ["--configuration-cache"]
105+
run-using = tooling-api // value can be "cli" or "tooling-api"
106+
daemon = warm // value can be "warm", "cold", or "none"
107+
copy-file = {
108+
source = "build-tools-internal/performance/test-files/BenchmarkingTests.java"
109+
target = "x-pack/plugin/esql/src/test/java/org/elasticsearch/gradle/benchmarking/BenchmarkingTests.java"
110+
schedule = SCENARIO
111+
}
112+
git-checkout = {
113+
cleanup = "main"
114+
build = "main"
115+
}
116+
warm-ups = 3
117+
iterations = 10
118+
}

0 commit comments

Comments
 (0)