aerospike / aerospike-client-java

Aerospike Java Client Library
Other
236 stars 212 forks source link

Add support for io_uring with Netty #198

Closed yuzawa-san closed 3 years ago

yuzawa-san commented 3 years ago

Netty has recently added support for an experimental new type of transport which used Linux's io_uring facility. This PR allows users to pass in a IOUringEventLoopGroup to the NettyEventLoops constructor. This is an optional dependency like the other native transports. The EventLoopType determination is currently done sequentially, so I changed it to use a switch statement. I believe if the optional dependency was not provided the instanceof would fail with an ClassNotFoundException instead of falling down to the "Unexpected EventLoopGroup" exception. Using the class names prevents that.

BrianNichols commented 3 years ago

Looks promising. I'm not sure the class name switch statement prevents the ClassNotFoundException if the optional dependency is not provided. I will evaluate when I get some time.

BrianNichols commented 3 years ago

I modified this pull request to restore the old instanceof checks and catch NoClassDefFoundError when the optional library is not included. Instanceof works better because it handles custom classes that inherit from the classes we are trying to detect.

I also added support for io_uring in the new eventLoopType command line argument in examples, benchmarks, and test.

These changes are included in the stage branch. Stage will be merged into master in the next client release.

yuzawa-san commented 3 years ago

Ok sounds good. I'm going to close this PR since these changes have been applied in https://github.com/aerospike/aerospike-client-java/commit/a11f7743d20d98f74524fad01a145c80e7d117cd