-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HBASE-26708 Make Netty channel bytebuf allocator configurable.
Support site configuration of the bytebuf allocator that Netty will use for NettyRpcServer channels. Property name is 'hbase.netty.rpcserver.allocator'. Default is no value, which is equivalent to "pooled". Valid values are: - "pooled": use PooledByteBufAllocator - "unpooled": use UnpooledByteBufAllocator - "heap": use HeapByteBufAllocator, which is a PooledByteBufAllocator that preferentially allocates buffers on heap wherever possible
- Loading branch information
Showing
3 changed files
with
99 additions
and
10 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/HeapByteBufAllocator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.apache.hadoop.hbase.ipc; | ||
|
||
import org.apache.hadoop.hbase.HBaseInterfaceAudience; | ||
import org.apache.yetus.audience.InterfaceAudience; | ||
|
||
import org.apache.hbase.thirdparty.io.netty.buffer.PooledByteBufAllocator; | ||
|
||
/** | ||
* A PooledByteBufAllocator that does not prefer direct buffers regardless of platform settings. | ||
* <p> | ||
* In some cases direct buffers are still required, like IO buffers where the buffer will be used in | ||
* conjunction with a native method call, so we cannot force all buffer usage on heap. But we can | ||
* strongly prefer it. | ||
*/ | ||
@InterfaceAudience.LimitedPrivate({ HBaseInterfaceAudience.CONFIG }) | ||
public class HeapByteBufAllocator extends PooledByteBufAllocator { | ||
|
||
public static final HeapByteBufAllocator DEFAULT = new HeapByteBufAllocator(); | ||
|
||
public HeapByteBufAllocator() { | ||
super(false /* preferDirect */); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters