Skip to content

Add an Epoll benchmark#8249

Closed
carl-mastrangelo wants to merge 3 commits intonetty:4.1from
carl-mastrangelo:notimer2
Closed

Add an Epoll benchmark#8249
carl-mastrangelo wants to merge 3 commits intonetty:4.1from
carl-mastrangelo:notimer2

Conversation

@carl-mastrangelo
Copy link
Copy Markdown
Member

Motivation:
Optimizing the Epoll channel needs an objective measure of how fast
it is.

Modification:
Add a simple, closed loop, ping-pong benchmark.

Result:
Benchmark can be used to measure #7816

Motivation:
Optimizing the Epoll channel needs an objective measure of how fast
it is.

Modification:
Add a simple, closed loop,  ping-pong benchmark.

Result:
Benchmark can be used to measure netty#7816

Initial numbers:

```
Result "io.netty.microbench.channel.epoll.EpollSocketChannelBenchmark.pingPong":
  22614.403 ±(99.9%) 797.263 ops/s [Average]
  (min, avg, max) = (21093.160, 22614.403, 24977.387), stdev = 918.130
  CI (99.9%): [21817.140, 23411.666] (assumes normal distribution)

Benchmark                              Mode  Cnt      Score     Error  Units
EpollSocketChannelBenchmark.pingPong  thrpt   20  22614.403 ± 797.263  ops/s
```
@carl-mastrangelo
Copy link
Copy Markdown
Member Author

Result "io.netty.microbench.channel.epoll.EpollSocketChannelBenchmark.pingPong":
  22614.403 ±(99.9%) 797.263 ops/s [Average]
  (min, avg, max) = (21093.160, 22614.403, 24977.387), stdev = 918.130
  CI (99.9%): [21817.140, 23411.666] (assumes normal distribution)


# Run complete. Total time: 00:00:41

Benchmark                              Mode  Cnt      Score     Error  Units
EpollSocketChannelBenchmark.pingPong  thrpt   20  22614.403 ± 797.263  ops/s

private ScheduledFuture<?> future;

@Setup
public void setup() throws Exception {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use 4 spaces

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

public void channelRead(ChannelHandlerContext ctx, Object msg) {
if (msg instanceof ByteBuf) {
ctx.writeAndFlush(msg, ctx.voidPromise());
return;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return is not needed.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

protected void initChannel(Channel ch) {
ch.pipeline().addLast(new ChannelDuplexHandler() {

ChannelPromise lastWritePromise;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

private ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-transport-native-epoll</artifactId>
<version>${project.version}</version>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

classifier is missing:

          <classifier>linux-x86_64</classifier>

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@carl-mastrangelo
Copy link
Copy Markdown
Member Author

@normanmaurer PTAL

@normanmaurer
Copy link
Copy Markdown
Member

@carl-mastrangelo thanks! Made a small change so we are able to compile the microbenchmarks still on macOS and pulled in.

@normanmaurer
Copy link
Copy Markdown
Member

Cherry-picked as 379a56c

@normanmaurer normanmaurer self-assigned this Sep 4, 2018
@normanmaurer normanmaurer added this to the 4.1.30.Final milestone Sep 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants