1 Reply Latest reply on May 25, 2017 2:38 PM by william.burns

    Off heap cache - Can ByteBuffer be returned?

    genman

      I would think a typical use case for Infinispan would be to send cached data to a network client.

       

      Assuming that the off-heap cache is storing an array of bytes, is it possible that "get" return a ByteBuffer, which can be used to send data down a file or socket?

       

      Although ideally it'd be nice to directly use Linux's send() to directly write off-heap memory to a file or socket. I would think this would a "killer" feature that would be fairly easy to implement.

       

      But I'm not sure how the API could work? My thinking would be something like

       

      Cache.send(key: Key, descriptor: FileDescriptor, off: Int = 0, len: Int = 0): Int -- where off/len are optional

       

      Of course this would be very OS dependent but it would be very high performance.

        • 1. Re: Off heap cache - Can ByteBuffer be returned?
          william.burns

          There are plans to do this in the future, but this requires a lot of internal changes. The initial off heap changes are very narrow in scope and allow users to avoid GC pauses with extremely large amount of memory used (as long as entries are not excessively large themselves). To properly use mapped files/off heap to the full extent we will need to change multiple layers and also have proper support in JGroups which handles our cluster communication.

           

          We were also hoping to take this a step further and integrate off heap/mapped files with persistent memory pmem.io: Home as well.

           

          Unfortunately I have no idea when this would come to fruition.