Github user dineshjoshi commented on a diff in the pull request:
https://github.com/apache/cassandra/pull/279#discussion_r227581961
--- Diff:
test/burn/org/apache/cassandra/utils/memory/LongBufferPoolTest.java ---
@@ -36,9 +36,34 @@
import static org.junit.Assert.*;
+/**
+ * Long BufferPool test - make sure that the BufferPool allocates and
recycles
+ * ByteBuffers under heavy concurrent usage.
+ *
+ * The test creates two groups of threads
+ *
+ * - the burn producer/consumer pair that allocates 1/10 poolSize and then
returns
+ * all the memory to the pool. 50% is freed by the producer, 50% passed
to the consumer thread.
+ *
+ * - a ring of worker threads that allocate buffers and either immediately
free them,
+ * or pass to the next worker thread for it to be freed on it's behalf.
Periodically
+ * all memory is freed by the thread.
+ *
+ * While the burn/worker threads run, the original main thread checks that
all of the threads are still
+ * making progress every 10s (no locking issues, or exits from assertion
failures),
+ * and that every chunk has been freed at least once during the previous
cycle (if that was possible).
+ *
+ * The test does not expect to survive out-of-memory errors, so needs
sufficient heap memory
+ * for non-direct buffers and the debug tracking objects that check the
allocate buffers.
+ * (The timing is very interesting when Xmx is lowered to increase garbage
collection pauses, but do
+ * not set it too low).
+ */
public class LongBufferPoolTest
{
private static final Logger logger =
LoggerFactory.getLogger(LongBufferPoolTest.class);
+ final int avgBufferSize = 16 << 10;
--- End diff --
Constants are typically uppercased with underscores as separators eg.
`AVG_BUFFER_SIZE`. Do you also need this to be package private? It can be made
private and static.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]