vert.x icon indicating copy to clipboard operation
vert.x copied to clipboard

Support IO_URING transport

Open franz1981 opened this issue 4 years ago • 6 comments

I'm implementing support for https://github.com/netty/netty-incubator-transport-io_uring on Vert-x Transport, see https://github.com/franz1981/vert.x/tree/4.2.1_iouring for some initial experiment.

franz1981 avatar Nov 09 '21 12:11 franz1981

There are some test failures related missing sendFile support that I'm working around by forcing supportsFileRegion to return false with IoUring on ConnectionBase::sendFile:

  public final ChannelFuture sendFile(RandomAccessFile raf, long offset, long length) throws IOException {
    // Write the content.
    ChannelPromise writeFuture = chctx.newPromise();
    if (!supportsFileRegion()) {
      // Cannot use zero-copy
      writeToChannel(new ChunkedFile(raf, offset, length, 8192), writeFuture);
    } else {
      // No encryption - use zero-copy.
      sendFileRegion(raf, offset, length, writeFuture);
    }
    if (writeFuture != null) {
      writeFuture.addListener(fut -> raf.close());
    } else {
      raf.close();
    }
    return writeFuture;
  }

The downside is that writeToChannel too doesn't seems to work correctly and I'm investigating what's going on.

franz1981 avatar Nov 09 '21 12:11 franz1981

I've fixed https://github.com/eclipse-vertx/vert.x/issues/4163#issuecomment-964126155 with https://github.com/franz1981/vert.x/commit/4eafe9ff3fdaad1ab79768b02465aaacadd1f1eb

franz1981 avatar Nov 09 '21 13:11 franz1981

Just FYI this is the last run:

Results :

Failed tests: 
  Http1xTest>HttpTest.testListenDomainSocketAddress:144->HttpTestBase.startServer:93->HttpTestBase.startServer:118->AsyncTestBase.awaitLatch:598->AsyncTestBase.awaitLatch:602->AsyncTestBase.assertTrue:378 null
  Http2ClientTest.lambda$testNetSocketConnect$198:1428->AsyncTestBase.assertEquals:241 expected:<2> but was:<1>
  Http2ServerTest.lambda$testNetSocketConnect$250:2251->AsyncTestBase.assertEquals:241 expected:<2> but was:<1>
  Http2Test>HttpTest.testListenDomainSocketAddress:144->HttpTestBase.startServer:93->HttpTestBase.startServer:118->AsyncTestBase.awaitLatch:598->AsyncTestBase.awaitLatch:602->AsyncTestBase.assertTrue:378 null
  Http2Test>HttpTest.lambda$testServerConnectionHandlerClose$573:3625->AsyncTestBase.fail:414 null
  NetTest.testListenDomainSocketAddress:1896->startServer:3843->startServer:3855->AsyncTestBase.awaitLatch:598->AsyncTestBase.awaitLatch:602->AsyncTestBase.assertTrue:378 null
  NetTest.access$2400:77->AsyncTestBase.assertEquals:360 expected:<true> but was:<false>
Tests in error: 
  DatagramTest.testPauseResume:209->AsyncTestBase.await:121->AsyncTestBase.await:133 » IllegalState
  Http1xTest>AsyncTestBase.after:83->HttpTestBase.tearDown:69->VertxTestBase.tearDown:87->AsyncTestBase.close:662->AsyncTestBase.awaitLatch:598->AsyncTestBase.awaitLatch:602->AsyncTestBase.assertTrue:380->AsyncTestBase.handleThrowable:183 » IllegalState
  Http2MetricsTest.testPushPromise:99->AsyncTestBase.await:121->AsyncTestBase.await:133 » IllegalState
  Http2MetricsTest>AsyncTestBase.after:83->HttpMetricsTestBase.tearDown:54->HttpTestBase.tearDown:69->VertxTestBase.tearDown:87->AsyncTestBase.close:662->AsyncTestBase.awaitLatch:598->AsyncTestBase.awaitLatch:602->AsyncTestBase.assertTrue:380->AsyncTestBase.handleThrowable:183 » IllegalState
  Http2MetricsTest>AsyncTestBase.after:83->HttpMetricsTestBase.tearDown:54->HttpTestBase.tearDown:69->VertxTestBase.tearDown:87->AsyncTestBase.close:662->AsyncTestBase.awaitLatch:598->AsyncTestBase.awaitLatch:602->AsyncTestBase.assertTrue:380->AsyncTestBase.handleThrowable:183 » IllegalState
  Http2ServerTest.testUpgradeToClearTextGet:2546->testUpgradeToClearText:2607->AsyncTestBase.await:121->AsyncTestBase.await:133 » IllegalState
  Http2Test>AsyncTestBase.after:83->HttpTestBase.tearDown:69->VertxTestBase.tearDown:87->AsyncTestBase.close:662->AsyncTestBase.awaitLatch:598->AsyncTestBase.awaitLatch:602->AsyncTestBase.assertTrue:380->AsyncTestBase.handleThrowable:183 » IllegalState
  NetTest>AsyncTestBase.after:83->tearDown:129->VertxTestBase.tearDown:87->AsyncTestBase.close:662->AsyncTestBase.awaitLatch:598->AsyncTestBase.awaitLatch:602->AsyncTestBase.assertTrue:380->AsyncTestBase.handleThrowable:183 » IllegalState
  NetTest.testStartTLSClientCertClientNotTrusted:1317->testTLS:1571->testTLS:1601->AsyncTestBase.await:121->AsyncTestBase.await:133 » IllegalState

Tests run: 4760, Failures: 7, Errors: 9, Skipped: 14

And many of these tests shouldn't run because are using domain socket, that's still not supported

I'm going to prepare a draft PR ASAP

franz1981 avatar Nov 09 '21 14:11 franz1981

Thank you for looking into this. It's great to have feedback and a contribution in the making!

tsegismont avatar Nov 09 '21 14:11 tsegismont

The transport should be optional and only used when the jar is present on the classpath and native epoll is not present

vietj avatar Nov 10 '21 09:11 vietj

The transport should be optional and only used when the jar is present on the classpath and native epoll is not present

Haven't checked the latest version of the code, but that's how it was working when I tested an early preview.

Sanne avatar Nov 10 '21 14:11 Sanne