Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved abstractions + better object construction #96

Merged
merged 12 commits into from
Jan 29, 2020
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
public final class NonBlockingStatsDClientMaxPerfTest {

private static final int testWorkers = 4;
private static final int port = 17255;
private final int processorWorkers;
private final int senderWorkers;
private final int port;
private final int duration; // Duration in secs
private final int qSize; // Queue length (number of elements)

Expand All @@ -41,43 +41,67 @@ public final class NonBlockingStatsDClientMaxPerfTest {
@Parameters
public static Collection<Object[]> data() {
return Arrays.asList(new Object[][] {
{ 30, 17255, 256, 1, 1 }, // 30 seconds, 17255 port, 256 qSize, 1 worker
{ 30, 17255, 512, 1, 1 }, // 30 seconds, 17255 port, 512 qSize, 1 worker
{ 30, 17255, 1024, 1, 1 }, // 30 seconds, 17255 port, 1024 qSize, 1 worker
{ 30, 17255, 2048, 1, 1 }, // 30 seconds, 17255 port, 2048 qSize, 1 worker
{ 30, 17255, 4096, 1, 1 }, // 30 seconds, 17255 port, 4096 qSize, 1 worker
// { 30, 17260, Integer.MAX_VALUE, 1 }, // 30 seconds, 17255 port, MAX_VALUE qSize, 1 worker
{ 30, 17255, 256, 2, 1 }, // 30 seconds, 17255 port, 256 qSize, 2 workers
{ 30, 17255, 512, 2, 1 }, // 30 seconds, 17255 port, 512 qSize, 2 workers
{ 30, 17255, 1024, 2, 1 }, // 30 seconds, 17255 port, 1024 qSize, 2 workers
{ 30, 17255, 2048, 2, 1 }, // 30 seconds, 17255 port, 2048 qSize, 2 workers
{ 30, 17255, 4096, 2, 1 }, // 30 seconds, 17255 port, 4096 qSize, 2 workers
// // { 30, 17255, Integer.MAX_VALUE, 2 } // 30 seconds, 17255 port, MAX_VALUE qSize, 2 workers
{ 30, 17255, 256, 1, 2}, // 30 seconds, 17255 port, 256 qSize, 1 sender worker, 2 processor workers
{ 30, 17255, 512, 1, 2 }, // 30 seconds, 17255 port, 512 qSize, 1 sender worker, 2 processor workers
{ 30, 17255, 1024, 1, 2 }, // 30 seconds, 17255 port, 1024 qSize, 1 sender worker, 2 processor workers
{ 30, 17255, 2048, 1, 2 }, // 30 seconds, 17255 port, 2048 qSize, 1 sender worke, 2 processor workers
{ 30, 17255, 4096, 1, 2 }, // 30 seconds, 17255 port, 4096 qSize, 1 sender worke, 2 processor workers
// // { 30, 17255, Integer.MAX_VALUE, 1, 2 }, // 30 seconds, 17255 port, MAX_VALUE qSize, 1 worker
{ 30, 17255, 256, 2, 2 }, // 30 seconds, 17255 port, 256 qSize, 2 sender workers, 2 processor workers
{ 30, 17255, 512, 2, 2 }, // 30 seconds, 17255 port, 512 qSize, 2 sender workers, 2 processor workers
{ 30, 17255, 1024, 2, 2 }, // 30 seconds, 17255 port, 1024 qSize, 2 sender workers, 2 processor workers
{ 30, 17255, 2048, 2, 2 }, // 30 seconds, 17255 port, 2048 qSize, 2 sender workers, 2 processor workers
{ 30, 17255, 4096, 2, 2 } // 30 seconds, 17255 port, 4096 qSize, 2 sender workers, 2 processor workers
// // { 30, 17255, Integer.MAX_VALUE, 2 } // 30 seconds, 17255 port, MAX_VALUE qSize, 2 sender workers
{ 30, false, 256, 1, 1 }, // 30 seconds, non-blocking, 256 qSize, 1 worker
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: This collection could be created with 3 "for loop" (non-blocking, Qsize, worker count)

{ 30, false, 512, 1, 1 }, // 30 seconds, non-blocking, 512 qSize, 1 worker
{ 30, false, 1024, 1, 1 }, // 30 seconds, non-blocking, 1024 qSize, 1 worker
{ 30, false, 2048, 1, 1 }, // 30 seconds, non-blocking, 2048 qSize, 1 worker
{ 30, false, 4096, 1, 1 }, // 30 seconds, non-blocking, 4096 qSize, 1 worker
// { 30, 17260, Integer.MAX_VALUE, 1 }, // 30 seconds, non-blocking, MAX_VALUE qSize, 1 worker
{ 30, false, 256, 2, 1 }, // 30 seconds, non-blocking, 256 qSize, 2 workers
{ 30, false, 512, 2, 1 }, // 30 seconds, non-blocking, 512 qSize, 2 workers
{ 30, false, 1024, 2, 1 }, // 30 seconds, non-blocking, 1024 qSize, 2 workers
{ 30, false, 2048, 2, 1 }, // 30 seconds, non-blocking, 2048 qSize, 2 workers
{ 30, false, 4096, 2, 1 }, // 30 seconds, non-blocking, 4096 qSize, 2 workers
// // { 30, false, Integer.MAX_VALUE, 2 } // 30 seconds, non-blocking, MAX_VALUE qSize, 2 workers
{ 30, false, 256, 1, 2}, // 30 seconds, non-blocking, 256 qSize, 1 sender worker, 2 processor workers
{ 30, false, 512, 1, 2 }, // 30 seconds, non-blocking, 512 qSize, 1 sender worker, 2 processor workers
{ 30, false, 1024, 1, 2 }, // 30 seconds, non-blocking, 1024 qSize, 1 sender worker, 2 processor workers
{ 30, false, 2048, 1, 2 }, // 30 seconds, non-blocking, 2048 qSize, 1 sender worke, 2 processor workers
{ 30, false, 4096, 1, 2 }, // 30 seconds, non-blocking, 4096 qSize, 1 sender worke, 2 processor workers
// // { 30, false, Integer.MAX_VALUE, 1, 2 }, // 30 seconds, non-blocking, MAX_VALUE qSize, 1 worker
{ 30, false, 256, 2, 2 }, // 30 seconds, non-blocking, 256 qSize, 2 sender workers, 2 processor workers
{ 30, false, 512, 2, 2 }, // 30 seconds, non-blocking, 512 qSize, 2 sender workers, 2 processor workers
{ 30, false, 1024, 2, 2 }, // 30 seconds, non-blocking, 1024 qSize, 2 sender workers, 2 processor workers
{ 30, false, 2048, 2, 2 }, // 30 seconds, non-blocking, 2048 qSize, 2 sender workers, 2 processor workers
{ 30, false, 4096, 2, 2 }, // 30 seconds, non-blocking, 4096 qSize, 2 sender workers, 2 processor workers
// // { 30, false, Integer.MAX_VALUE, 2 } // 30 seconds, non-blocking, MAX_VALUE qSize, 2 sender workers
{ 30, true, 256, 1, 1 }, // 30 seconds, non-blocking, 256 qSize, 1 worker
{ 30, true, 512, 1, 1 }, // 30 seconds, non-blocking, 512 qSize, 1 worker
{ 30, true, 1024, 1, 1 }, // 30 seconds, non-blocking, 1024 qSize, 1 worker
{ 30, true, 2048, 1, 1 }, // 30 seconds, non-blocking, 2048 qSize, 1 worker
{ 30, true, 4096, 1, 1 }, // 30 seconds, non-blocking, 4096 qSize, 1 worker
// { 30, 17260, Integer.MAX_VALUE, 1 }, // 30 seconds, non-blocking, MAX_VALUE qSize, 1 worker
{ 30, true, 256, 2, 1 }, // 30 seconds, non-blocking, 256 qSize, 2 workers
{ 30, true, 512, 2, 1 }, // 30 seconds, non-blocking, 512 qSize, 2 workers
{ 30, true, 1024, 2, 1 }, // 30 seconds, non-blocking, 1024 qSize, 2 workers
{ 30, true, 2048, 2, 1 }, // 30 seconds, non-blocking, 2048 qSize, 2 workers
{ 30, true, 4096, 2, 1 }, // 30 seconds, non-blocking, 4096 qSize, 2 workers
// // { 30, true, Integer.MAX_VALUE, 2 } // 30 seconds, non-blocking, MAX_VALUE qSize, 2 workers
{ 30, true, 256, 1, 2}, // 30 seconds, non-blocking, 256 qSize, 1 sender worker, 2 processor workers
{ 30, true, 512, 1, 2 }, // 30 seconds, non-blocking, 512 qSize, 1 sender worker, 2 processor workers
{ 30, true, 1024, 1, 2 }, // 30 seconds, non-blocking, 1024 qSize, 1 sender worker, 2 processor workers
{ 30, true, 2048, 1, 2 }, // 30 seconds, non-blocking, 2048 qSize, 1 sender worke, 2 processor workers
{ 30, true, 4096, 1, 2 }, // 30 seconds, non-blocking, 4096 qSize, 1 sender worke, 2 processor workers
// // { 30, true, Integer.MAX_VALUE, 1, 2 }, // 30 seconds, non-blocking, MAX_VALUE qSize, 1 worker
{ 30, true, 256, 2, 2 }, // 30 seconds, non-blocking, 256 qSize, 2 sender workers, 2 processor workers
{ 30, true, 512, 2, 2 }, // 30 seconds, non-blocking, 512 qSize, 2 sender workers, 2 processor workers
{ 30, true, 1024, 2, 2 }, // 30 seconds, non-blocking, 1024 qSize, 2 sender workers, 2 processor workers
{ 30, true, 2048, 2, 2 }, // 30 seconds, non-blocking, 2048 qSize, 2 sender workers, 2 processor workers
{ 30, true, 4096, 2, 2 }, // 30 seconds, non-blocking, 4096 qSize, 2 sender workers, 2 processor workers
// // { 30, true, Integer.MAX_VALUE, 2 } // 30 seconds, non-blocking, MAX_VALUE qSize, 2 sender workers
});
}

public NonBlockingStatsDClientMaxPerfTest(int duration, int port, int qSize,
public NonBlockingStatsDClientMaxPerfTest(int duration, boolean blocking, int qSize,
int processorWorkers, int senderWorkers) throws IOException {
this.duration = duration;
this.port = port;
this.qSize = qSize;
this.processorWorkers = processorWorkers;
this.senderWorkers = senderWorkers;
this.client = new NonBlockingStatsDClientBuilder().prefix("my.prefix")
.hostname("localhost")
.port(port)
.blocking(blocking)
.queueSize(qSize)
.senderWorkers(senderWorkers)
.processorWorkers(processorWorkers)
Expand Down