[ 
https://issues.apache.org/jira/browse/HDDS-9032?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Duong updated HDDS-9032:
------------------------
    Description: 
Ozone datanode today uses 2 separated Netty memory pool (or 
PooledByteBufAllocator) instances.

First pool instance is created with NettyServer (used by Ratis server and 
Replication server). All NettyServer instances share a same 
PooledByteBufAllocator instances (or the same direct memory pool), which is 
created and cached by  ByteBufAllocatorPreferDirectHolder.allocator.  this 
resolves to the usage of "io.grpc.netty.Utils#getByteBufAllocator".
{code:java}
public static ByteBufAllocator getByteBufAllocator(boolean forceHeapBuffer) {
  if (Boolean.parseBoolean(
          
System.getProperty("org.apache.ratis.thirdparty.io.grpc.netty.useCustomAllocator",
 "true"))) {
    boolean defaultPreferDirect = PooledByteBufAllocator.defaultPreferDirect();
    logger.log(
        Level.FINE,
        String.format(
            "Using custom allocator: forceHeapBuffer=%s, 
defaultPreferDirect=%s",
            forceHeapBuffer,
            defaultPreferDirect));
    if (forceHeapBuffer || !defaultPreferDirect) {
      return ByteBufAllocatorPreferHeapHolder.allocator;
    } else {
      return ByteBufAllocatorPreferDirectHolder.allocator;
    } {code}
The second instance is created from the usage of 
[CodecBuffer|https://github.com/apache/ozone/blob/master/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/utils/db/CodecBuffer.java#L85-86].
 This CodecBuffer uses the default Netty memory pool
{code:java}
  private static final ByteBufAllocator POOL
      = PooledByteBufAllocator.DEFAULT; {code}
 

  was:
Ozone datanode today uses 2 separated Netty memory pool (or 
PooledByteBufAllocator) instances.

First pool instance is created with NettyServer (used by Ratis server and 
replication server). All NettyServer share a same PooledByteBufAllocator 
instances (or the same direct memory pool), which is created and cached by  
ByteBufAllocatorPreferDirectHolder.allocator.  this resolves to the usage of 
"io.grpc.netty.Utils#getByteBufAllocator".
{code:java}
public static ByteBufAllocator getByteBufAllocator(boolean forceHeapBuffer) {
  if (Boolean.parseBoolean(
          
System.getProperty("org.apache.ratis.thirdparty.io.grpc.netty.useCustomAllocator",
 "true"))) {
    boolean defaultPreferDirect = PooledByteBufAllocator.defaultPreferDirect();
    logger.log(
        Level.FINE,
        String.format(
            "Using custom allocator: forceHeapBuffer=%s, 
defaultPreferDirect=%s",
            forceHeapBuffer,
            defaultPreferDirect));
    if (forceHeapBuffer || !defaultPreferDirect) {
      return ByteBufAllocatorPreferHeapHolder.allocator;
    } else {
      return ByteBufAllocatorPreferDirectHolder.allocator;
    } {code}
The second instance is created from the usage of 
[CodecBuffer|https://github.com/apache/ozone/blob/master/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/utils/db/CodecBuffer.java#L85-86].
 This CodecBuffer uses the default Netty memory pool
{code:java}
  private static final ByteBufAllocator POOL
      = PooledByteBufAllocator.DEFAULT; {code}
 


> CodecBuffer results in Ozone Datanode using 2 separate Netty memory pool 
> instances
> ----------------------------------------------------------------------------------
>
>                 Key: HDDS-9032
>                 URL: https://issues.apache.org/jira/browse/HDDS-9032
>             Project: Apache Ozone
>          Issue Type: Bug
>            Reporter: Duong
>            Priority: Major
>
> Ozone datanode today uses 2 separated Netty memory pool (or 
> PooledByteBufAllocator) instances.
> First pool instance is created with NettyServer (used by Ratis server and 
> Replication server). All NettyServer instances share a same 
> PooledByteBufAllocator instances (or the same direct memory pool), which is 
> created and cached by  ByteBufAllocatorPreferDirectHolder.allocator.  this 
> resolves to the usage of "io.grpc.netty.Utils#getByteBufAllocator".
> {code:java}
> public static ByteBufAllocator getByteBufAllocator(boolean forceHeapBuffer) {
>   if (Boolean.parseBoolean(
>           
> System.getProperty("org.apache.ratis.thirdparty.io.grpc.netty.useCustomAllocator",
>  "true"))) {
>     boolean defaultPreferDirect = 
> PooledByteBufAllocator.defaultPreferDirect();
>     logger.log(
>         Level.FINE,
>         String.format(
>             "Using custom allocator: forceHeapBuffer=%s, 
> defaultPreferDirect=%s",
>             forceHeapBuffer,
>             defaultPreferDirect));
>     if (forceHeapBuffer || !defaultPreferDirect) {
>       return ByteBufAllocatorPreferHeapHolder.allocator;
>     } else {
>       return ByteBufAllocatorPreferDirectHolder.allocator;
>     } {code}
> The second instance is created from the usage of 
> [CodecBuffer|https://github.com/apache/ozone/blob/master/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/utils/db/CodecBuffer.java#L85-86].
>  This CodecBuffer uses the default Netty memory pool
> {code:java}
>   private static final ByteBufAllocator POOL
>       = PooledByteBufAllocator.DEFAULT; {code}
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to