adoroszlai commented on code in PR #10536:
URL: https://github.com/apache/ozone/pull/10536#discussion_r3454883413
##########
hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/common/ChunkBuffer.java:
##########
@@ -17,18 +17,30 @@
package org.apache.hadoop.ozone.common;
+import com.google.common.annotations.VisibleForTesting;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.GatheringByteChannel;
import java.util.List;
import java.util.Objects;
+import java.util.concurrent.atomic.AtomicBoolean;
import org.apache.hadoop.hdds.utils.db.CodecBuffer;
import org.apache.ratis.thirdparty.com.google.protobuf.ByteString;
import org.apache.ratis.util.UncheckedAutoCloseable;
/** Buffer for a block chunk. */
public interface ChunkBuffer extends ChunkBufferToByteString,
UncheckedAutoCloseable {
+ /**
+ * When true, {@link #allocate} uses direct ByteBuffers instead of heap
ByteBuffers.
+ * Set only by {@link BlockOutputStreamWriteBenchmark} to compare allocation
strategies
+ * within a single benchmark run; must never be modified in production code.
+ */
+ @VisibleForTesting
+ // CHECKSTYLE:OFF VisibilityModifier
+ AtomicBoolean ALLOCATE_DIRECT = new AtomicBoolean(false);
+ // CHECKSTYLE:ON VisibilityModifier
Review Comment:
The benchmark needs to test various implementations. Adding the benchmark
code to the `master` branch in the main Ozone repo requires that those
implementations also exist there. Choosing between the implementations using
an internal toggle that even requires `CHECKSTYLE:OFF`-style hacks is ugly.
Results may depend on hardware/software environment. Providing this simple
toggle configuration does not add much complexity, but enables users to test in
their own environment if needed.
I would prefer adding performance tests in a separate repo:
- various POC implementations can be freely added without affecting
production code
- JMH can be used without license problems (HDDS-6202)
- can test different versions of Ozone
- performance tests would not be confused with functional tests (see
`TestUnhealthyContainersDerbyPerformance`)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]