Uploaded image for project: 'HBase'
  1. HBase
  2. HBASE-22802

Avoid temp ByteBuffer allocation in FileIOEngine#read

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 3.0.0-alpha-1, 2.3.0
    • BucketCache
    • None
    • Reviewed
    • Hide
      HBASE-21879 introduces a utility class (org.apache.hadoop.hbase.io.ByteBuffAllocator) used for allocating/freeing ByteBuffers from/to NIO ByteBuffer pool, when BucketCache enabled with file or mmap engine, we will use this ByteBuffer pool to avoid temp ByteBuffer allocation a lot.
      Show
      HBASE-21879 introduces a utility class (org.apache.hadoop.hbase.io.ByteBuffAllocator) used for allocating/freeing ByteBuffers from/to NIO ByteBuffer pool, when BucketCache enabled with file or mmap engine, we will use this ByteBuffer pool to avoid temp ByteBuffer allocation a lot.

    Description

      a temp ByteBuffer was allocated each time FileIOEngine#read was called

      public Cacheable read(BucketEntry be) throws IOException {
        long offset = be.offset();
        int length = be.getLength();
        Preconditions.checkArgument(length >= 0, "Length of read can not be less than 0.");
        ByteBuffer dstBuffer = ByteBuffer.allocate(length);
        ...
      }
      

      we can avoid this by use of ByteBuffAllocator#allocate(length) after HBASE-21879

      Attachments

        1. HBASE-22802-master-v1.patch
          27 kB
          chenxu
        2. profile_mem_alloc_with_pool.png
          754 kB
          chenxu
        3. profile_mem_alloc.png
          548 kB
          chenxu

        Issue Links

          Activity

            People

              javaman_chen chenxu
              javaman_chen chenxu
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: