Skip to content

Commit

Permalink
feat: record pooled record memory usage (#846)
Browse files Browse the repository at this point in the history
Signed-off-by: Robin Han <[email protected]>
  • Loading branch information
superhx authored Feb 27, 2024
1 parent d971f8e commit 6b7f329
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@

public class ElasticLogFileRecords {
private static final Logger LOGGER = LoggerFactory.getLogger(ElasticLogFileRecords.class);
private static final int POOLED_MEMORY_RECORDS = 30;
static {
DirectByteBufAlloc.registerAllocType(POOLED_MEMORY_RECORDS, "pooled_memory_records");
}

protected final AtomicInteger size;
// only used for recover
protected final Iterable<RecordBatch> batches;
Expand Down Expand Up @@ -320,7 +325,7 @@ private PooledMemoryRecords(long logBaseOffset, List<FetchResult> fetchResults,
}
// TODO: create a new ByteBufMemoryRecords data struct to avoid copy
if (pooled) {
this.pack = DirectByteBufAlloc.byteBuffer(size);
this.pack = DirectByteBufAlloc.byteBuffer(size, POOLED_MEMORY_RECORDS);
} else {
this.pack = Unpooled.buffer(size);
}
Expand Down

0 comments on commit 6b7f329

Please sign in to comment.