hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anoopsamj...@apache.org
Subject hbase git commit: HBASE-13819 Make RPC layer CellBlock buffer a DirectByteBuffer.
Date Tue, 13 Oct 2015 02:29:32 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1 411683c22 -> 5dba2c71f


HBASE-13819 Make RPC layer CellBlock buffer a DirectByteBuffer.


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/5dba2c71
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/5dba2c71
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/5dba2c71

Branch: refs/heads/branch-1
Commit: 5dba2c71f7f4b48ec1d8e6b54e2efe59e77f4b77
Parents: 411683c
Author: anoopsjohn <anoopsamjohn@gmail.com>
Authored: Tue Oct 13 07:59:11 2015 +0530
Committer: anoopsjohn <anoopsamjohn@gmail.com>
Committed: Tue Oct 13 07:59:11 2015 +0530

----------------------------------------------------------------------
 .../org/apache/hadoop/hbase/io/BoundedByteBufferPool.java   | 9 +++++++--
 .../apache/hadoop/hbase/io/TestBoundedByteBufferPool.java   | 4 ++--
 .../main/java/org/apache/hadoop/hbase/ipc/RpcServer.java    | 4 +++-
 3 files changed, 12 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/5dba2c71/hbase-common/src/main/java/org/apache/hadoop/hbase/io/BoundedByteBufferPool.java
----------------------------------------------------------------------
diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/io/BoundedByteBufferPool.java
b/hbase-common/src/main/java/org/apache/hadoop/hbase/io/BoundedByteBufferPool.java
index c685a92..a8ff598 100644
--- a/hbase-common/src/main/java/org/apache/hadoop/hbase/io/BoundedByteBufferPool.java
+++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/io/BoundedByteBufferPool.java
@@ -67,16 +67,20 @@ public class BoundedByteBufferPool {
 
   private ReentrantLock lock =  new ReentrantLock();
 
+  private boolean createDirectByteBuffer;
+
   /**
    * @param maxByteBufferSizeToCache
    * @param initialByteBufferSize
    * @param maxToCache
+   * @param createDirectByteBuffer whether the buffers created by this pool to be off heap
    */
   public BoundedByteBufferPool(final int maxByteBufferSizeToCache, final int initialByteBufferSize,
-      final int maxToCache) {
+      final int maxToCache, final boolean createDirectByteBuffer) {
     this.maxByteBufferSizeToCache = maxByteBufferSizeToCache;
     this.runningAverage = initialByteBufferSize;
     this.buffers = new BoundedArrayQueue<ByteBuffer>(maxToCache);
+    this.createDirectByteBuffer = createDirectByteBuffer;
   }
 
   public ByteBuffer getBuffer() {
@@ -94,7 +98,8 @@ public class BoundedByteBufferPool {
       // Clear sets limit == capacity. Postion == 0.
       bb.clear();
     } else {
-      bb = ByteBuffer.allocate(this.runningAverage);
+      bb = this.createDirectByteBuffer ? ByteBuffer.allocateDirect(this.runningAverage)
+          : ByteBuffer.allocate(this.runningAverage);
       this.allocations.incrementAndGet();
     }
     if (LOG.isTraceEnabled()) {

http://git-wip-us.apache.org/repos/asf/hbase/blob/5dba2c71/hbase-common/src/test/java/org/apache/hadoop/hbase/io/TestBoundedByteBufferPool.java
----------------------------------------------------------------------
diff --git a/hbase-common/src/test/java/org/apache/hadoop/hbase/io/TestBoundedByteBufferPool.java
b/hbase-common/src/test/java/org/apache/hadoop/hbase/io/TestBoundedByteBufferPool.java
index 5074b4c..987a2ff 100644
--- a/hbase-common/src/test/java/org/apache/hadoop/hbase/io/TestBoundedByteBufferPool.java
+++ b/hbase-common/src/test/java/org/apache/hadoop/hbase/io/TestBoundedByteBufferPool.java
@@ -37,8 +37,8 @@ public class TestBoundedByteBufferPool {
 
   @Before
   public void before() {
-    this.reservoir =
-      new BoundedByteBufferPool(maxByteBufferSizeToCache, initialByteBufferSize, maxToCache);
+    this.reservoir = new BoundedByteBufferPool(maxByteBufferSizeToCache, initialByteBufferSize,
+        maxToCache, false);
   }
 
   @After

http://git-wip-us.apache.org/repos/asf/hbase/blob/5dba2c71/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java
index ac428da..2b67817 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java
@@ -1967,7 +1967,9 @@ public class RpcServer implements RpcServerInterface {
       // Make the max twice the number of handlers to be safe.
       conf.getInt("hbase.ipc.server.reservoir.initial.max",
         conf.getInt(HConstants.REGION_SERVER_HANDLER_COUNT,
-          HConstants.DEFAULT_REGION_SERVER_HANDLER_COUNT) * 2));
+          HConstants.DEFAULT_REGION_SERVER_HANDLER_COUNT) * 2),
+      // By default make direct byte buffers from the buffer pool.
+      conf.getBoolean("hbase.ipc.server.reservoir.direct.buffer", true));
     this.server = server;
     this.services = services;
     this.bindAddress = bindAddress;


Mime
View raw message