Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apm-agent-benchmarks/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>org.openjdk.jmh.Main</mainClass>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
</transformers>
<filters>
<filter>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@
* Licensed 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.
* #L%
*/
package co.elastic.apm.impl;
package co.elastic.apm.benchmark;

import co.elastic.apm.CpuProfiler;
import co.elastic.apm.benchmark.profiler.CpuProfiler;
import org.openjdk.jmh.annotations.Fork;
import org.openjdk.jmh.annotations.Measurement;
import org.openjdk.jmh.annotations.Scope;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,19 @@
* Licensed 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.
* #L%
*/
package co.elastic.apm;
package co.elastic.apm.benchmark;

import co.elastic.apm.configuration.CoreConfiguration;
import co.elastic.apm.impl.AbstractBenchmark;
import co.elastic.apm.impl.ElasticApmTracer;
import co.elastic.apm.report.Reporter;
import co.elastic.apm.servlet.ApmFilter;
Expand Down Expand Up @@ -88,7 +87,7 @@
@BenchmarkMode(Mode.SampleTime)
@OutputTimeUnit(TimeUnit.MICROSECONDS)
@State(Scope.Thread)
public class ElasticApmBenchmark extends AbstractBenchmark {
public class ElasticApmContinuousBenchmark extends AbstractBenchmark {

private ApmFilter apmFilter;
private MockHttpServletRequest request;
Expand All @@ -101,7 +100,7 @@ public class ElasticApmBenchmark extends AbstractBenchmark {
private FilterChain filterChainWithoutApm;

public static void main(String[] args) throws RunnerException {
run(ElasticApmBenchmark.class);
run(ElasticApmContinuousBenchmark.class);
}

@Setup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,19 @@
* Licensed 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.
* #L%
*/
package co.elastic.apm.impl;
package co.elastic.apm.benchmark.objectpool;

import co.elastic.apm.benchmark.AbstractBenchmark;
import co.elastic.apm.impl.transaction.Transaction;
import co.elastic.apm.objectpool.impl.BlockingQueueObjectPool;
import co.elastic.apm.objectpool.impl.MixedObjectPool;
Expand All @@ -28,39 +29,24 @@
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.annotations.OutputTimeUnit;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.TearDown;
import org.openjdk.jmh.annotations.Threads;
import org.openjdk.jmh.profile.GCProfiler;
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.concurrent.TimeUnit;

@State(Scope.Benchmark)
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public class ObjectPoolBenchmark {
public class ObjectPoolBenchmark extends AbstractBenchmark {

private RingBufferObjectPool<Transaction> ringBufferObjectPool;
private BlockingQueueObjectPool<Transaction> blockingQueueObjectPool;
private MixedObjectPool<Transaction> mixedObjectPool;
private ThreadLocalObjectPool<Transaction> threadLocalObjectPool;

public static void main(String[] args) throws RunnerException {
Options opt = new OptionsBuilder()
.include(ObjectPoolBenchmark.class.getSimpleName())
.warmupIterations(2)
.measurementIterations(2)
.forks(1)
.addProfiler(GCProfiler.class)
.build();

new Runner(opt).run();
run(ObjectPoolBenchmark.class);
}

@Setup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@
* Licensed 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.
* #L%
*/
package co.elastic.apm;
package co.elastic.apm.benchmark.profiler;

import com.sun.management.OperatingSystemMXBean;
import org.openjdk.jmh.infra.BenchmarkParams;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
* limitations under the License.
* #L%
*/
package co.elastic.apm.impl;
package co.elastic.apm.benchmark.reporter;

import co.elastic.apm.CpuProfiler;
import co.elastic.apm.benchmark.profiler.CpuProfiler;
import co.elastic.apm.report.serialize.JacksonPayloadSerializer;
import co.elastic.apm.report.serialize.PayloadSerializer;
import com.fasterxml.jackson.databind.ObjectMapper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* limitations under the License.
* #L%
*/
package co.elastic.apm.impl;
package co.elastic.apm.benchmark.reporter;

import co.elastic.apm.report.ApmServerHttpPayloadSender;
import co.elastic.apm.report.PayloadSender;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@
* limitations under the License.
* #L%
*/
package co.elastic.apm.impl;
package co.elastic.apm.benchmark.reporter;

import co.elastic.apm.benchmark.AbstractBenchmark;
import co.elastic.apm.impl.ElasticApmTracer;
import co.elastic.apm.impl.context.Context;
import co.elastic.apm.impl.context.Request;
import co.elastic.apm.impl.payload.Agent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,11 @@
* limitations under the License.
* #L%
*/
package co.elastic.apm.impl;
package co.elastic.apm.benchmark.reporter;

import co.elastic.apm.CpuProfiler;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.dataformat.cbor.CBORFactory;
import org.openjdk.jmh.profile.GCProfiler;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.OptionsBuilder;

public class HttpCborJacksonReporterBenchmark extends AbstractHttpJacksonReporterBenchmark {

Expand All @@ -36,12 +32,7 @@ public class HttpCborJacksonReporterBenchmark extends AbstractHttpJacksonReporte
* {@code java -jar apm-agent-benchmarks/target/benchmarks.jar -prof gc}
*/
public static void main(String[] args) throws RunnerException {
new Runner(new OptionsBuilder()
.include(HttpCborJacksonReporterBenchmark.class.getSimpleName())
.addProfiler(GCProfiler.class)
.addProfiler(CpuProfiler.class)
.build())
.run();
run(HttpCborJacksonReporterBenchmark.class);
}

protected ObjectMapper getObjectMapper() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@
* limitations under the License.
* #L%
*/
package co.elastic.apm.impl;
package co.elastic.apm.benchmark.reporter;

import co.elastic.apm.CpuProfiler;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.openjdk.jmh.profile.GCProfiler;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.OptionsBuilder;

public class HttpVanillaJacksonReporterBenchmark extends AbstractHttpJacksonReporterBenchmark {
/**
* Measures the performance of the actually used reporter implementation
* including JSON serialization and reporting payloads over HTTP
*/
public class HttpJacksonReporterContinuousBenchmark extends AbstractHttpJacksonReporterBenchmark {

/**
* Convenience benchmark run method
Expand All @@ -35,12 +35,7 @@ public class HttpVanillaJacksonReporterBenchmark extends AbstractHttpJacksonRepo
* {@code java -jar apm-agent-benchmarks/target/benchmarks.jar -prof gc}
*/
public static void main(String[] args) throws RunnerException {
new Runner(new OptionsBuilder()
.include(HttpVanillaJacksonReporterBenchmark.class.getSimpleName())
.addProfiler(GCProfiler.class)
.addProfiler(CpuProfiler.class)
.build())
.run();
run(HttpJacksonReporterContinuousBenchmark.class);
}

protected ObjectMapper getObjectMapper() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,11 @@
* limitations under the License.
* #L%
*/
package co.elastic.apm.impl;
package co.elastic.apm.benchmark.reporter;

import co.elastic.apm.report.serialize.MoshiPayloadSerializer;
import co.elastic.apm.benchmark.serializer.MoshiPayloadSerializer;
import co.elastic.apm.report.serialize.PayloadSerializer;
import org.openjdk.jmh.profile.GCProfiler;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.OptionsBuilder;

public class HttpMoshiReporterBenchmark extends AbstractHttpReporterBenchmark {

Expand All @@ -35,11 +32,7 @@ public class HttpMoshiReporterBenchmark extends AbstractHttpReporterBenchmark {
* {@code java -jar apm-agent-benchmarks/target/benchmarks.jar -prof gc}
*/
public static void main(String[] args) throws RunnerException {
new Runner(new OptionsBuilder()
.include(HttpMoshiReporterBenchmark.class.getSimpleName())
.addProfiler(GCProfiler.class)
.build())
.run();
run(HttpMoshiReporterBenchmark.class);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,10 @@
* limitations under the License.
* #L%
*/
package co.elastic.apm.impl;
package co.elastic.apm.benchmark.reporter;

import co.elastic.apm.report.serialize.PayloadSerializer;
import org.openjdk.jmh.profile.GCProfiler;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.OptionsBuilder;

public class HttpNoopJsonReporterBenchmark extends AbstractHttpReporterBenchmark {

Expand All @@ -34,11 +31,7 @@ public class HttpNoopJsonReporterBenchmark extends AbstractHttpReporterBenchmark
* {@code java -jar apm-agent-benchmarks/target/benchmarks.jar -prof gc}
*/
public static void main(String[] args) throws RunnerException {
new Runner(new OptionsBuilder()
.include(HttpNoopJsonReporterBenchmark.class.getSimpleName())
.addProfiler(GCProfiler.class)
.build())
.run();
run(HttpNoopJsonReporterBenchmark.class);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,16 @@
* limitations under the License.
* #L%
*/
package co.elastic.apm.impl;
package co.elastic.apm.benchmark.reporter;

import co.elastic.apm.impl.payload.Payload;
import co.elastic.apm.report.PayloadSender;
import org.openjdk.jmh.profile.GCProfiler;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.OptionsBuilder;

/**
* Measures how many events the reporter can handle,
* not accounting for JSON serialization and sending payloads over HTTP.
*/
public class NoopReporterBenchmark extends AbstractReporterBenchmark {

/**
Expand All @@ -35,11 +36,7 @@ public class NoopReporterBenchmark extends AbstractReporterBenchmark {
* {@code java -jar apm-agent-benchmarks/target/benchmarks.jar -prof gc}
*/
public static void main(String[] args) throws RunnerException {
new Runner(new OptionsBuilder()
.include(NoopReporterBenchmark.class.getSimpleName())
.addProfiler(GCProfiler.class)
.build())
.run();
run(NoopReporterBenchmark.class);
}

protected PayloadSender getPayloadSender() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* limitations under the License.
* #L%
*/
package co.elastic.apm.report.serialize;
package co.elastic.apm.benchmark.serializer;

import co.elastic.apm.impl.payload.Payload;
import co.elastic.apm.report.serialize.PayloadSerializer;
Expand Down
Loading