Home / Class/ AbstractSslHandlerThroughputBenchmark Class — netty Architecture

AbstractSslHandlerThroughputBenchmark Class — netty Architecture

Architecture documentation for the AbstractSslHandlerThroughputBenchmark class in AbstractSslHandlerThroughputBenchmark.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  08b990fd_7d02_bdd6_b438_263a2d2f6a56["AbstractSslHandlerThroughputBenchmark"]
  b8181328_b706_08b5_a27e_3fad8e0e79f7["AbstractSslHandlerThroughputBenchmark.java"]
  08b990fd_7d02_bdd6_b438_263a2d2f6a56 -->|defined in| b8181328_b706_08b5_a27e_3fad8e0e79f7
  7786ed23_5e51_a848_8b88_f00c1526b15b["setup()"]
  08b990fd_7d02_bdd6_b438_263a2d2f6a56 -->|method| 7786ed23_5e51_a848_8b88_f00c1526b15b
  fcfe0216_7fa4_5a51_9a3f_edbefa12103d["tearDown()"]
  08b990fd_7d02_bdd6_b438_263a2d2f6a56 -->|method| fcfe0216_7fa4_5a51_9a3f_edbefa12103d
  3037f5b0_1bdb_ec02_f363_232ffad9e178["ByteBuf()"]
  08b990fd_7d02_bdd6_b438_263a2d2f6a56 -->|method| 3037f5b0_1bdb_ec02_f363_232ffad9e178

Relationship Graph

Source Code

microbench/src/main/java/io/netty/microbench/handler/ssl/AbstractSslHandlerThroughputBenchmark.java lines 28–95

public abstract class AbstractSslHandlerThroughputBenchmark extends AbstractSslHandlerBenchmark {
    @Param({ "64", "128", "512", "1024", "4096" })
    public int messageSize;

    @Param
    public BufferType bufferType;

    public enum BufferType {
        HEAP {
            @Override
            ByteBuf newBuffer(ByteBufAllocator allocator, int size) {
                return allocator.heapBuffer(size);
            }
        },
        DIRECT {
            @Override
            ByteBuf newBuffer(ByteBufAllocator allocator, int size) {
                return allocator.directBuffer(size);
            }
        };

        abstract ByteBuf newBuffer(ByteBufAllocator allocator, int size);
    }

    protected ByteBuf wrapSrcBuffer;
    protected EmbeddedChannel channel;
    private ByteBufAllocator allocator;

    @Setup(Level.Iteration)
    public final void setup() throws Exception {
        allocator = new PooledByteBufAllocator(true);

        initSslHandlers(allocator);

        wrapSrcBuffer = allocateBuffer(messageSize);

        byte[] bytes = new byte[messageSize];
        ThreadLocalRandom.current().nextBytes(bytes);
        wrapSrcBuffer.writeBytes(bytes);

        // Complete the initial TLS handshake.
        doHandshake();
    }

    @TearDown(Level.Iteration)
    public final void tearDown() throws Exception {
        destroySslHandlers();
        wrapSrcBuffer.release();
        clientCtx.releaseCumulation();
        serverCtx.releaseCumulation();
    }

    protected final ByteBuf allocateBuffer(int size) {
        return bufferType.newBuffer(allocator, size);
    }

    protected final ByteBuf doWrite(int numWrites) throws Exception {
        clientCtx.releaseCumulation();

        for (int i = 0; i < numWrites; ++i) {
            ByteBuf wrapSrcBuffer = this.wrapSrcBuffer.retainedSlice();

            clientSslHandler.write(clientCtx, wrapSrcBuffer, clientCtx.voidPromise());
        }
        clientSslHandler.flush(clientCtx);
        return clientCtx.cumulation().retainedSlice();
    }
}

Frequently Asked Questions

What is the AbstractSslHandlerThroughputBenchmark class?
AbstractSslHandlerThroughputBenchmark is a class in the netty codebase, defined in microbench/src/main/java/io/netty/microbench/handler/ssl/AbstractSslHandlerThroughputBenchmark.java.
Where is AbstractSslHandlerThroughputBenchmark defined?
AbstractSslHandlerThroughputBenchmark is defined in microbench/src/main/java/io/netty/microbench/handler/ssl/AbstractSslHandlerThroughputBenchmark.java at line 28.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free