HttpPipelinedRequestDecoderBenchmark Class — netty Architecture
Architecture documentation for the HttpPipelinedRequestDecoderBenchmark class in HttpPipelinedRequestDecoderBenchmark.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 32a7d68f_9a9a_90eb_4ba9_69c43a157613["HttpPipelinedRequestDecoderBenchmark"] 3850907c_e458_7cc7_2688_0e5b20792204["HttpPipelinedRequestDecoderBenchmark.java"] 32a7d68f_9a9a_90eb_4ba9_69c43a157613 -->|defined in| 3850907c_e458_7cc7_2688_0e5b20792204 fba8b8b6_2b65_35da_1aea_4671eafbee08["initPipeline()"] 32a7d68f_9a9a_90eb_4ba9_69c43a157613 -->|method| fba8b8b6_2b65_35da_1aea_4671eafbee08 51cbddf0_0d89_81e5_8252_55108c237518["ByteBuf()"] 32a7d68f_9a9a_90eb_4ba9_69c43a157613 -->|method| 51cbddf0_0d89_81e5_8252_55108c237518 b239a202_455f_2882_873f_d75317a591f8["testDecodeWholePipelinedRequestMixedDelimiters()"] 32a7d68f_9a9a_90eb_4ba9_69c43a157613 -->|method| b239a202_455f_2882_873f_d75317a591f8 25031a14_5f23_b9b6_7218_a7a95968117a["release()"] 32a7d68f_9a9a_90eb_4ba9_69c43a157613 -->|method| 25031a14_5f23_b9b6_7218_a7a95968117a
Relationship Graph
Source Code
microbench/src/main/java/io/netty/microbench/http/HttpPipelinedRequestDecoderBenchmark.java lines 49–112
@State(Scope.Benchmark)
@Warmup(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS)
@Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS)
public class HttpPipelinedRequestDecoderBenchmark extends AbstractMicrobenchmark {
@Param({ "false", "true" })
public boolean direct;
@Param({ "1", "16" })
public int pipeline;
@Param({ "false", "true" })
public boolean pooled;
@Param({ "true", "false" })
public boolean validateHeaders;
private EmbeddedChannel channel;
private ByteBuf pipelinedRequest;
@Setup
public void initPipeline() {
final ByteBufAllocator allocator = pooled? PooledByteBufAllocator.DEFAULT : UnpooledByteBufAllocator.DEFAULT;
pipelinedRequest = pipelined(allocator, CONTENT_MIXED_DELIMITERS, pipeline, direct);
channel = new EmbeddedChannel(
new HttpRequestDecoder(DEFAULT_MAX_INITIAL_LINE_LENGTH, DEFAULT_MAX_HEADER_SIZE, DEFAULT_MAX_CHUNK_SIZE,
validateHeaders, DEFAULT_INITIAL_BUFFER_SIZE));
// this is a trick to save doing it each time
pipelinedRequest.retain((Integer.MAX_VALUE / 2 - 1) - pipeline);
}
private static ByteBuf pipelined(ByteBufAllocator alloc, byte[] content, int pipeline, boolean direct) {
final int totalSize = pipeline * content.length;
final ByteBuf buf = direct? alloc.directBuffer(totalSize, totalSize) : alloc.heapBuffer(totalSize, totalSize);
for (int i = 0; i < pipeline; i++) {
buf.writeBytes(content);
}
return buf;
}
@Benchmark
@CompilerControl(Mode.DONT_INLINE)
public void testDecodeWholePipelinedRequestMixedDelimiters() {
final EmbeddedChannel channel = this.channel;
final ByteBuf batch = this.pipelinedRequest;
final int refCnt = batch.refCnt();
if (refCnt == 1) {
batch.retain((Integer.MAX_VALUE / 2 - 1) - pipeline);
}
batch.resetReaderIndex();
channel.writeInbound(batch);
final Queue<Object> decoded = channel.inboundMessages();
Object o;
while ((o = decoded.poll()) != null) {
ReferenceCountUtil.release(o);
}
}
@TearDown
public void release() {
this.pipelinedRequest.release(pipelinedRequest.refCnt());
}
}
Defined In
Source
Frequently Asked Questions
What is the HttpPipelinedRequestDecoderBenchmark class?
HttpPipelinedRequestDecoderBenchmark is a class in the netty codebase, defined in microbench/src/main/java/io/netty/microbench/http/HttpPipelinedRequestDecoderBenchmark.java.
Where is HttpPipelinedRequestDecoderBenchmark defined?
HttpPipelinedRequestDecoderBenchmark is defined in microbench/src/main/java/io/netty/microbench/http/HttpPipelinedRequestDecoderBenchmark.java at line 49.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free