Search in sources :

Example 26 with Setup

use of org.openjdk.jmh.annotations.Setup in project grpc-java by grpc.

the class UnaryCallQpsBenchmark method setup.

/**
   * Setup with direct executors, small payloads and a large flow control window.
   */
@Setup(Level.Trial)
public void setup() throws Exception {
    super.setup(ExecutorType.DIRECT, ExecutorType.DIRECT, MessageSize.SMALL, MessageSize.SMALL, FlowWindowSize.LARGE, ChannelType.NIO, maxConcurrentStreams, channelCount);
    callCounter = new AtomicLong();
    completed = new AtomicBoolean();
    startUnaryCalls(maxConcurrentStreams, callCounter, completed, 1);
}
Also used : AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) AtomicLong(java.util.concurrent.atomic.AtomicLong) Setup(org.openjdk.jmh.annotations.Setup)

Example 27 with Setup

use of org.openjdk.jmh.annotations.Setup in project grpc-java by grpc.

the class TransportBenchmark method setUp.

@Setup
public void setUp() throws Exception {
    AbstractServerImplBuilder<?> serverBuilder;
    AbstractManagedChannelImplBuilder<?> channelBuilder;
    switch(transport) {
        case INPROCESS:
            {
                String name = "bench" + Math.random();
                serverBuilder = InProcessServerBuilder.forName(name);
                channelBuilder = InProcessChannelBuilder.forName(name);
                break;
            }
        case NETTY:
            {
                InetSocketAddress address = new InetSocketAddress("localhost", pickUnusedPort());
                serverBuilder = NettyServerBuilder.forAddress(address);
                channelBuilder = NettyChannelBuilder.forAddress(address).negotiationType(NegotiationType.PLAINTEXT);
                break;
            }
        case NETTY_LOCAL:
            {
                String name = "bench" + Math.random();
                LocalAddress address = new LocalAddress(name);
                serverBuilder = NettyServerBuilder.forAddress(address).channelType(LocalServerChannel.class);
                channelBuilder = NettyChannelBuilder.forAddress(address).channelType(LocalChannel.class).negotiationType(NegotiationType.PLAINTEXT);
                break;
            }
        case NETTY_EPOLL:
            {
                InetSocketAddress address = new InetSocketAddress("localhost", pickUnusedPort());
                // Reflection used since they are only available on linux.
                Class<?> groupClass = Class.forName("io.netty.channel.epoll.EpollEventLoopGroup");
                EventLoopGroup group = (EventLoopGroup) groupClass.getConstructor().newInstance();
                @SuppressWarnings("unchecked") Class<? extends ServerChannel> serverChannelClass = (Class<? extends ServerChannel>) Class.forName("io.netty.channel.epoll.EpollServerSocketChannel");
                serverBuilder = NettyServerBuilder.forAddress(address).bossEventLoopGroup(group).workerEventLoopGroup(group).channelType(serverChannelClass);
                @SuppressWarnings("unchecked") Class<? extends Channel> channelClass = (Class<? extends Channel>) Class.forName("io.netty.channel.epoll.EpollSocketChannel");
                channelBuilder = NettyChannelBuilder.forAddress(address).eventLoopGroup(group).channelType(channelClass).negotiationType(NegotiationType.PLAINTEXT);
                groupToShutdown = group;
                break;
            }
        case OKHTTP:
            {
                int port = pickUnusedPort();
                InetSocketAddress address = new InetSocketAddress("localhost", port);
                serverBuilder = NettyServerBuilder.forAddress(address);
                channelBuilder = OkHttpChannelBuilder.forAddress("localhost", port).negotiationType(io.grpc.okhttp.NegotiationType.PLAINTEXT);
                break;
            }
        default:
            throw new Exception("Unknown transport: " + transport);
    }
    if (direct) {
        serverBuilder.directExecutor();
        // Because blocking stubs avoid the executor, this doesn't do much.
        channelBuilder.directExecutor();
    }
    server = serverBuilder.addService(new AsyncServer.BenchmarkServiceImpl()).build();
    server.start();
    channel = channelBuilder.build();
    stub = BenchmarkServiceGrpc.newBlockingStub(channel);
    // Wait for channel to start
    stub.unaryCall(SimpleRequest.getDefaultInstance());
}
Also used : LocalAddress(io.netty.channel.local.LocalAddress) InetSocketAddress(java.net.InetSocketAddress) LocalChannel(io.netty.channel.local.LocalChannel) ManagedChannel(io.grpc.ManagedChannel) LocalServerChannel(io.netty.channel.local.LocalServerChannel) LocalChannel(io.netty.channel.local.LocalChannel) ServerChannel(io.netty.channel.ServerChannel) Channel(io.netty.channel.Channel) AsyncServer(io.grpc.benchmarks.qps.AsyncServer) ByteString(com.google.protobuf.ByteString) LocalServerChannel(io.netty.channel.local.LocalServerChannel) ServerChannel(io.netty.channel.ServerChannel) EventLoopGroup(io.netty.channel.EventLoopGroup) Setup(org.openjdk.jmh.annotations.Setup)

Example 28 with Setup

use of org.openjdk.jmh.annotations.Setup in project hazelcast by hazelcast.

the class DefaultPortableReaderPerformanceTest method setup.

@Setup
public void setup() throws Exception {
    ss = new DefaultSerializationServiceBuilder().addPortableFactory(DefaultPortableReaderQuickTest.TestPortableFactory.ID, new DefaultPortableReaderQuickTest.TestPortableFactory()).build();
    Portable primitive = new DefaultPortableReaderTestStructure.PrimitivePortable();
    primitiveReader = reader(primitive);
    reader = reader(PORSCHE);
}
Also used : DefaultSerializationServiceBuilder(com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder) Portable(com.hazelcast.nio.serialization.Portable) Setup(org.openjdk.jmh.annotations.Setup)

Example 29 with Setup

use of org.openjdk.jmh.annotations.Setup in project HdrHistogram by HdrHistogram.

the class HdrHistogramRecordingBench method setup.

@Setup
public void setup() throws NoSuchMethodException {
    histogram = new Histogram(highestTrackableValue, numberOfSignificantValueDigits);
    synchronizedHistogram = new SynchronizedHistogram(highestTrackableValue, numberOfSignificantValueDigits);
    atomicHistogram = new AtomicHistogram(highestTrackableValue, numberOfSignificantValueDigits);
    concurrentHistogram = new ConcurrentHistogram(highestTrackableValue, numberOfSignificantValueDigits);
    recorder = new Recorder(highestTrackableValue, numberOfSignificantValueDigits);
    singleWriterRecorder = new SingleWriterRecorder(highestTrackableValue, numberOfSignificantValueDigits);
    doubleHistogram = new DoubleHistogram(highestTrackableValue, numberOfSignificantValueDigits);
    doubleRecorder = new DoubleRecorder(highestTrackableValue, numberOfSignificantValueDigits);
    singleWriterDoubleRecorder = new SingleWriterDoubleRecorder(highestTrackableValue, numberOfSignificantValueDigits);
}
Also used : AbstractHistogram(org.HdrHistogram.AbstractHistogram) HdrHistogram(org.HdrHistogram) Recorder(org.HdrHistogram.Recorder) Setup(org.openjdk.jmh.annotations.Setup)

Example 30 with Setup

use of org.openjdk.jmh.annotations.Setup in project logging-log4j2 by apache.

the class AbstractStringLayoutStringEncodingBenchmark method setUp.

@Setup
public void setUp() {
    bytes = new byte[128];
    for (int i = 0; i < bytes.length; i++) {
        bytes[i] = (byte) i;
    }
    usAsciiGetBytesLayout = new GetBytesLayout(Charset.forName("US-ASCII"));
    iso8859_1GetBytesLayout = new GetBytesLayout(Charset.forName("ISO-8859-1"));
    utf8GetBytesLayout = new GetBytesLayout(Charset.forName("UTF-8"));
    utf16GetBytesLayout = new GetBytesLayout(Charset.forName("UTF-16"));
    usAsciiEncodeLayout = new EncodeLayout(Charset.forName("US-ASCII"));
    iso8859_1EncodeLayout = new EncodeLayout(Charset.forName("ISO-8859-1"));
    utf8EncodeLayout = new EncodeLayout(Charset.forName("UTF-8"));
    utf16EncodeLayout = new EncodeLayout(Charset.forName("UTF-16"));
    final StringBuilder msg = new StringBuilder();
    msg.append(MESSAGE);
    logEvent = createLogEvent(new SimpleMessage(msg));
    destination = new Destination();
}
Also used : ByteBufferDestination(org.apache.logging.log4j.core.layout.ByteBufferDestination) SimpleMessage(org.apache.logging.log4j.message.SimpleMessage) Setup(org.openjdk.jmh.annotations.Setup)

Aggregations

Setup (org.openjdk.jmh.annotations.Setup)80 File (java.io.File)19 InputRow (io.druid.data.input.InputRow)15 BenchmarkDataGenerator (io.druid.benchmark.datagen.BenchmarkDataGenerator)14 HyperUniquesSerde (io.druid.query.aggregation.hyperloglog.HyperUniquesSerde)14 Random (java.util.Random)11 IndexSpec (io.druid.segment.IndexSpec)10 IncrementalIndex (io.druid.segment.incremental.IncrementalIndex)8 OnheapIncrementalIndex (io.druid.segment.incremental.OnheapIncrementalIndex)8 QueryableIndex (io.druid.segment.QueryableIndex)7 ByteBuffer (java.nio.ByteBuffer)7 StupidPool (io.druid.collections.StupidPool)4 OffheapBufferGenerator (io.druid.offheap.OffheapBufferGenerator)4 PooledByteBufAllocator (io.netty.buffer.PooledByteBufAllocator)4 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)4 AtomicLong (java.util.concurrent.atomic.AtomicLong)4 Function (com.google.common.base.Function)3 BitmapFactory (io.druid.collections.bitmap.BitmapFactory)3 ImmutableBitmap (io.druid.collections.bitmap.ImmutableBitmap)3 MutableBitmap (io.druid.collections.bitmap.MutableBitmap)3