Skip to content

Commit 6883e68

Browse files
committed
Use Netty's pooled memory allocator
Instead of the adaptative one, which is the default in 4.2. The pooled allocator was the default in 4.1.
1 parent 6fb8d24 commit 6883e68

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/main/java/com/rabbitmq/stream/perf/StreamPerfTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,7 @@ public Integer call() throws Exception {
803803
overridePropertiesWithEnvironmentVariables();
804804
Codec codec = createCodec(this.codecClass);
805805

806-
ByteBufAllocator byteBufAllocator = ByteBufAllocator.DEFAULT;
806+
ByteBufAllocator byteBufAllocator = Utils.byteBufAllocator();
807807

808808
CompositeMeterRegistry meterRegistry = new CompositeMeterRegistry();
809809
meterRegistry.config().commonTags(this.metricsTags);

src/main/java/com/rabbitmq/stream/perf/Utils.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
import io.micrometer.core.instrument.dropwizard.DropwizardConfig;
2727
import io.micrometer.core.instrument.dropwizard.DropwizardMeterRegistry;
2828
import io.micrometer.core.instrument.util.HierarchicalNameMapper;
29+
import io.netty.buffer.ByteBufAllocator;
30+
import io.netty.buffer.PooledByteBufAllocator;
2931
import java.io.PrintWriter;
3032
import java.lang.reflect.Constructor;
3133
import java.lang.reflect.Field;
@@ -186,6 +188,10 @@ static String formatByte(double bytes) {
186188
return String.format("%.1f %cB", bytes / 1000.0, ci.current());
187189
}
188190

191+
static ByteBufAllocator byteBufAllocator() {
192+
return PooledByteBufAllocator.DEFAULT;
193+
}
194+
189195
static long physicalMemory() {
190196
try {
191197
return TOTAL_MEMORY_SIZE_SUPPLIER.getAsLong();

0 commit comments

Comments
 (0)