[
https://issues.apache.org/jira/browse/HDDS-15931?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Chung-En Lee updated HDDS-15931:
--------------------------------
Description:
It would be better to not use netty internal `maxDirectMemory` and
`usedDirectMemory` in NettyMetrics#getMetrics.
`usedDirectMemory` can be replaced by netty public api. For example:
```
public long getUsedDirectMemory() {
ByteBufAllocator allocator = ByteBufAllocator.DEFAULT;
if (allocator instanceof ByteBufAllocatorMetricProvider)
{ ByteBufAllocatorMetric metric = ((ByteBufAllocatorMetricProvider)
allocator).metric(); return metric.usedDirectMemory(); }
return -1L;
}
```
`maxDirectMemory` depends on system property and jvm setting.
was:
It would be better to not use netty internal `maxDirectMemory` and
`usedDirectMemory` in NettyMetrics#getMetrics.
`usedDirectMemory` can be replaced by netty public api. For example:
```
public long getUsedDirectMemory() {
ByteBufAllocator allocator = ByteBufAllocator.DEFAULT; // 或使用專案中自訂的 Allocator
if (allocator instanceof ByteBufAllocatorMetricProvider) {
ByteBufAllocatorMetric metric = ((ByteBufAllocatorMetricProvider)
allocator).metric();
return metric.usedDirectMemory(); // 公開 API
}
return -1L;
}
```
`maxDirectMemory` depends on system property and jvm setting.
> Remove usage of internal netty metrics
> --------------------------------------
>
> Key: HDDS-15931
> URL: https://issues.apache.org/jira/browse/HDDS-15931
> Project: Apache Ozone
> Issue Type: Sub-task
> Reporter: Chung-En Lee
> Priority: Major
>
> It would be better to not use netty internal `maxDirectMemory` and
> `usedDirectMemory` in NettyMetrics#getMetrics.
> `usedDirectMemory` can be replaced by netty public api. For example:
> ```
> public long getUsedDirectMemory() {
> ByteBufAllocator allocator = ByteBufAllocator.DEFAULT;
> if (allocator instanceof ByteBufAllocatorMetricProvider)
> { ByteBufAllocatorMetric metric = ((ByteBufAllocatorMetricProvider)
> allocator).metric(); return metric.usedDirectMemory(); }
> return -1L;
> }
> ```
> `maxDirectMemory` depends on system property and jvm setting.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]