forked from elastic/elasticsearch
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into no_api_refresh_for_un…
…promotables
- Loading branch information
Showing
190 changed files
with
10,972 additions
and
1,238 deletions.
There are no files selected for viewing
79 changes: 79 additions & 0 deletions
79
benchmarks/src/main/java/org/elasticsearch/benchmark/tdigest/SortBench.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,79 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. 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. | ||
* | ||
* This project is based on a modification of https://github.com/tdunning/t-digest which is licensed under the Apache 2.0 License. | ||
*/ | ||
|
||
package org.elasticsearch.benchmark.tdigest; | ||
|
||
import org.elasticsearch.tdigest.Sort; | ||
import org.openjdk.jmh.annotations.Benchmark; | ||
import org.openjdk.jmh.annotations.BenchmarkMode; | ||
import org.openjdk.jmh.annotations.Fork; | ||
import org.openjdk.jmh.annotations.Measurement; | ||
import org.openjdk.jmh.annotations.Mode; | ||
import org.openjdk.jmh.annotations.OutputTimeUnit; | ||
import org.openjdk.jmh.annotations.Param; | ||
import org.openjdk.jmh.annotations.Scope; | ||
import org.openjdk.jmh.annotations.Setup; | ||
import org.openjdk.jmh.annotations.State; | ||
import org.openjdk.jmh.annotations.Threads; | ||
import org.openjdk.jmh.annotations.Warmup; | ||
|
||
import java.util.Arrays; | ||
import java.util.Random; | ||
import java.util.concurrent.TimeUnit; | ||
|
||
/** Explores the performance of Sort on pathological input data. */ | ||
@BenchmarkMode(Mode.AverageTime) | ||
@OutputTimeUnit(TimeUnit.MILLISECONDS) | ||
@Warmup(iterations = 10, time = 3, timeUnit = TimeUnit.SECONDS) | ||
@Measurement(iterations = 20, time = 2, timeUnit = TimeUnit.SECONDS) | ||
@Fork(1) | ||
@Threads(1) | ||
@State(Scope.Thread) | ||
public class SortBench { | ||
private final int size = 100000; | ||
private final double[] values = new double[size]; | ||
|
||
@Param({ "0", "1", "-1" }) | ||
public int sortDirection; | ||
|
||
@Setup | ||
public void setup() { | ||
Random prng = new Random(999983); | ||
for (int i = 0; i < size; i++) { | ||
values[i] = prng.nextDouble(); | ||
} | ||
if (sortDirection > 0) { | ||
Arrays.sort(values); | ||
} else if (sortDirection < 0) { | ||
Arrays.sort(values); | ||
Sort.reverse(values, 0, values.length); | ||
} | ||
} | ||
|
||
@Benchmark | ||
public void quicksort() { | ||
int[] order = new int[size]; | ||
for (int i = 0; i < size; i++) { | ||
order[i] = i; | ||
} | ||
Sort.sort(order, values, null, values.length); | ||
} | ||
} |
131 changes: 131 additions & 0 deletions
131
benchmarks/src/main/java/org/elasticsearch/benchmark/tdigest/TDigestBench.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,131 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. 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. | ||
* | ||
* This project is based on a modification of https://github.com/tdunning/t-digest which is licensed under the Apache 2.0 License. | ||
*/ | ||
|
||
package org.elasticsearch.benchmark.tdigest; | ||
|
||
import org.elasticsearch.tdigest.AVLTreeDigest; | ||
import org.elasticsearch.tdigest.MergingDigest; | ||
import org.elasticsearch.tdigest.TDigest; | ||
import org.openjdk.jmh.annotations.Benchmark; | ||
import org.openjdk.jmh.annotations.BenchmarkMode; | ||
import org.openjdk.jmh.annotations.Fork; | ||
import org.openjdk.jmh.annotations.Measurement; | ||
import org.openjdk.jmh.annotations.Mode; | ||
import org.openjdk.jmh.annotations.OutputTimeUnit; | ||
import org.openjdk.jmh.annotations.Param; | ||
import org.openjdk.jmh.annotations.Scope; | ||
import org.openjdk.jmh.annotations.Setup; | ||
import org.openjdk.jmh.annotations.State; | ||
import org.openjdk.jmh.annotations.Threads; | ||
import org.openjdk.jmh.annotations.Warmup; | ||
import org.openjdk.jmh.profile.GCProfiler; | ||
import org.openjdk.jmh.profile.StackProfiler; | ||
import org.openjdk.jmh.runner.Runner; | ||
import org.openjdk.jmh.runner.RunnerException; | ||
import org.openjdk.jmh.runner.options.Options; | ||
import org.openjdk.jmh.runner.options.OptionsBuilder; | ||
|
||
import java.util.Random; | ||
import java.util.concurrent.ThreadLocalRandom; | ||
import java.util.concurrent.TimeUnit; | ||
import java.util.function.Supplier; | ||
|
||
@BenchmarkMode(Mode.AverageTime) | ||
@OutputTimeUnit(TimeUnit.NANOSECONDS) | ||
@Warmup(iterations = 3, time = 3, timeUnit = TimeUnit.SECONDS) | ||
@Measurement(iterations = 5, time = 2, timeUnit = TimeUnit.SECONDS) | ||
@Fork(1) | ||
@Threads(1) | ||
@State(Scope.Thread) | ||
public class TDigestBench { | ||
|
||
public enum TDigestFactory { | ||
MERGE { | ||
@Override | ||
TDigest create(double compression) { | ||
return new MergingDigest(compression, (int) (10 * compression)); | ||
} | ||
}, | ||
AVL_TREE { | ||
@Override | ||
TDigest create(double compression) { | ||
return new AVLTreeDigest(compression); | ||
} | ||
}; | ||
|
||
abstract TDigest create(double compression); | ||
} | ||
|
||
@Param({ "100", "300" }) | ||
double compression; | ||
|
||
@Param({ "MERGE", "AVL_TREE" }) | ||
TDigestFactory tdigestFactory; | ||
|
||
@Param({ "NORMAL", "GAUSSIAN" }) | ||
String distribution; | ||
|
||
Random random; | ||
TDigest tdigest; | ||
|
||
double[] data = new double[1000000]; | ||
|
||
@Setup | ||
public void setUp() { | ||
random = ThreadLocalRandom.current(); | ||
tdigest = tdigestFactory.create(compression); | ||
|
||
Supplier<Double> nextRandom = () -> distribution.equals("GAUSSIAN") ? random.nextGaussian() : random.nextDouble(); | ||
for (int i = 0; i < 10000; ++i) { | ||
tdigest.add(nextRandom.get()); | ||
} | ||
|
||
for (int i = 0; i < data.length; ++i) { | ||
data[i] = nextRandom.get(); | ||
} | ||
} | ||
|
||
@State(Scope.Thread) | ||
public static class ThreadState { | ||
int index = 0; | ||
} | ||
|
||
@Benchmark | ||
@BenchmarkMode(Mode.AverageTime) | ||
@OutputTimeUnit(TimeUnit.MICROSECONDS) | ||
public void add(ThreadState state) { | ||
if (state.index >= data.length) { | ||
state.index = 0; | ||
} | ||
tdigest.add(data[state.index++]); | ||
} | ||
|
||
public static void main(String[] args) throws RunnerException { | ||
Options opt = new OptionsBuilder().include(".*" + TDigestBench.class.getSimpleName() + ".*") | ||
.warmupIterations(5) | ||
.measurementIterations(5) | ||
.addProfiler(GCProfiler.class) | ||
.addProfiler(StackProfiler.class) | ||
.build(); | ||
|
||
new Runner(opt).run(); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
pr: 94089 | ||
summary: Add support for `xlm_roberta` tokenized models | ||
area: Machine Learning | ||
type: feature | ||
issues: [] |
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,5 @@ | ||
pr: 96716 | ||
summary: Feature/speed up binary vector decoding | ||
area: Search | ||
type: enhancement | ||
issues: [] |
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,7 @@ | ||
pr: 96777 | ||
summary: Fixing `GeoIpDownloaderStatsAction$NodeResponse` serialization by defensively | ||
copying inputs | ||
area: Ingest Node | ||
type: bug | ||
issues: | ||
- 96438 |
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,5 @@ | ||
pr: 96790 | ||
summary: "[Profiling] Require POST to retrieve stacktraces" | ||
area: Application | ||
type: enhancement | ||
issues: [] |
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
Oops, something went wrong.