netty / netty-incubator-transport-io_uring

Apache License 2.0
193 stars 38 forks source link

Default iosqeAsyncThreshold slow for many connections #230

Closed yawkat closed 8 months ago

yawkat commented 9 months ago

The default iosqeAsyncThreshold (25) is comparatively slow when benchmarking many connections. This is a simple HTTP benchmark ( https://github.com/yawkat/micronaut-http-benchmarks/tree/262d50b525004c2c6dcd3fea8a442bab707fd638/test-case-pure-netty ). Each subplot shows a different request rate. The y axis is the request latency, the x axis the latency percentile. Blue is the default iosqeAsyncThreshold, Orange is an iosqeAsyncThreshold turned up to Integer.MAX_VALUE. The connection count is min(rps, 20000), i.e. for the low request rates each connection gets ~1 req/s, but it maxes out at 20000 connections so at the higher request rates there may be more req/s on each connection.

iosqeAsyncThreshold

As you can see, in all tested scenarios, IOSQE_ASYNC adds >30µs to the request latency. It also seems to worsen the max throughput. In a separate benchmark vs nio, this lead to worse performance for io-uring.

Thanks @franz1981 for pointing me towards this setting and its impact.

normanmaurer commented 9 months ago

@yawkat so what you suggest ?

franz1981 commented 9 months ago

Always Integer.MAX_VALUE IMO... it's easier to get it wrong than get it right If we leave the default as it is.... At worse users will have similar performance to epoll, really, because recv/write will always happen inline

normanmaurer commented 8 months ago

@yawkat @franz1981 feel free to do a PR