JUring: Experimental IO_uring For Java With Big Performance Gains

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • phoronix
    Administrator
    • Jan 2007
    • 67385

    JUring: Experimental IO_uring For Java With Big Performance Gains

    Phoronix: JUring: Experimental IO_uring For Java With Big Performance Gains

    For those looking toward better I/O performance with Java, there is JUring for making use of IO_uring and the reported performance benefits are very enticing...

    Phoronix, Linux Hardware Reviews, Linux hardware benchmarks, Linux server benchmarks, Linux benchmarking, Desktop Linux, Linux performance, Open Source graphics, Linux How To, Ubuntu benchmarks, Ubuntu hardware, Phoronix Test Suite
  • caligula
    Senior Member
    • Jan 2014
    • 3344

    #2
    I thought there are already io_uring libraries for java such as

    - https://github.com/bbeaupain/nio_uring
    - https://github.com/ikorennoy/jasyncfio

    Apparently this new one uses the Java 22's FFI API:https://openjdk.org/jeps/454

    Comment

    • hkupty
      Junior Member
      • Jun 2023
      • 40

      #3
      I had a look at the code and I can understand why the blocked version is actually slower than using a sync FileChannel, since it seems to be polluting the GC with many unnecessary disposable objects.
      This code needs some shaping up to become properly production ready as there are also some API issues, but it is nonetheless commendable that there are alternatives in java showing up and using modern APIs like panama's foreing function instead of JNI. Bright future for io_uring in the JVM world, hopefully.

      Comment

      • bug77
        Senior Member
        • Dec 2009
        • 6524

        #4
        Originally posted by hkupty View Post
        I had a look at the code and I can understand why the blocked version is actually slower than using a sync FileChannel, since it seems to be polluting the GC with many unnecessary disposable objects.
        This code needs some shaping up to become properly production ready as there are also some API issues, but it is nonetheless commendable that there are alternatives in java showing up and using modern APIs like panama's foreing function instead of JNI. Bright future for io_uring in the JVM world, hopefully.
        Tbh, I don't think this will end up in Java. Java doesn't have APIs that only work on Linux.
        IO_uring would need to go into the JVM itself instead, to be used, when appropriate, by existing APIs.

        Comment

        • cl333r
          Senior Member
          • Oct 2009
          • 2308

          #5
          Originally posted by bug77 View Post

          Tbh, I don't think this will end up in Java. Java doesn't have APIs that only work on Linux.
          IO_uring would need to go into the JVM itself instead, to be used, when appropriate, by existing APIs.
          I was wondering if other POSIX OSes will adopt io_uring or something similar, heck maybe even windows some day.

          Comment

          • hkupty
            Junior Member
            • Jun 2023
            • 40

            #6
            Originally posted by bug77 View Post

            Tbh, I don't think this will end up in Java. Java doesn't have APIs that only work on Linux.
            IO_uring would need to go into the JVM itself instead, to be used, when appropriate, by existing APIs.
            I remember seeing some vague discussion about using io_uring on some implementation under the hood for nio, but that was not at all guaranteed, which I why I think this kind of project is a good idea, just in its initial stages yet so I wouldn't use it in production.

            Comment

            • bug77
              Senior Member
              • Dec 2009
              • 6524

              #7
              Originally posted by hkupty View Post

              I remember seeing some vague discussion about using io_uring on some implementation under the hood for nio, but that was not at all guaranteed, which I why I think this kind of project is a good idea, just in its initial stages yet so I wouldn't use it in production.
              I agree that you gotta start somewhere. I was just saying, this is really experimental, nothing like what it will be (hopefully) implemented.
              And yes, at this point io_uring wouldn't be guaranteed even on Linux, you gotta query the kernel for that. All the more reason to let the JVM do this, rather than creating an API class specifically for using io_uring.
              I mean, I don't see io_uring any different from SSE. SSE is not part of Java API, I bet io_uring won't be either.

              Comment

              • jokeyrhyme
                Phoronix Member
                • Aug 2010
                • 60

                #8
                It's entirely possible this is wrong, but my understanding is that io_uring's async model is more similar to Windows than it is to Linux's epoll, given that user land code is notified when work is completed

                I think in epoll, user land code submits work and the submission blocks until it is ready to begin

                Right?

                Comment

                • hkupty
                  Junior Member
                  • Jun 2023
                  • 40

                  #9
                  Originally posted by jokeyrhyme View Post
                  It's entirely possible this is wrong, but my understanding is that io_uring's async model is more similar to Windows than it is to Linux's epoll, given that user land code is notified when work is completed

                  I think in epoll, user land code submits work and the submission blocks until it is ready to begin

                  Right?
                  I haven't written any epoll directly so I might be wrong but in epoll you have a series of file descriptors and you check all of them for some IO. In io_uring, you have two ring buffers: a submission buffer where you send work to the kernel and a notification buffer where you get the result. There's still polling but that happens without syscalls/context switching between userspace and kernelspace.

                  Comment

                  • geearf
                    Senior Member
                    • Dec 2011
                    • 2151

                    #10
                    Could this be of any use for Android since so many of the apps are in Java?

                    Comment

                    Working...
                    X