From 14f2166cdaba7fff4dc9a3f0f5111d61cdb7211d Mon Sep 17 00:00:00 2001 From: ayoub Date: Tue, 9 Aug 2016 07:38:21 -0500 Subject: [PATCH 1/8] Add config manager for openstack perf utility --- .../examples/perf/openstack/Consumer.java | 5 ++ .../examples/perf/openstack/Producer.java | 14 ++++ .../perf/openstack/samples/Configuration.java | 66 +++++++++++++++++++ 3 files changed, 85 insertions(+) create mode 100644 src/test/java/com/rabbitmq/examples/perf/openstack/Consumer.java create mode 100644 src/test/java/com/rabbitmq/examples/perf/openstack/Producer.java create mode 100644 src/test/java/com/rabbitmq/examples/perf/openstack/samples/Configuration.java diff --git a/src/test/java/com/rabbitmq/examples/perf/openstack/Consumer.java b/src/test/java/com/rabbitmq/examples/perf/openstack/Consumer.java new file mode 100644 index 0000000000..b372182a79 --- /dev/null +++ b/src/test/java/com/rabbitmq/examples/perf/openstack/Consumer.java @@ -0,0 +1,5 @@ +package com.rabbitmq.examples.perf.openstack; + +public class Consumer { + +} diff --git a/src/test/java/com/rabbitmq/examples/perf/openstack/Producer.java b/src/test/java/com/rabbitmq/examples/perf/openstack/Producer.java new file mode 100644 index 0000000000..4ecaa536cc --- /dev/null +++ b/src/test/java/com/rabbitmq/examples/perf/openstack/Producer.java @@ -0,0 +1,14 @@ +package com.rabbitmq.examples.perf.openstack; + +import com.rabbitmq.examples.perf.ProducerConsumerBase; + +/* + * This producer will publish OpenStack-alike messages to the RabbitMQ server. + * These messages simulate the OpenStack heartbeats, in particular, those that + * are used by Nova and Neutron modules to update N-CPU, L2, L3 and DHCP agents' + * status. + */ + +public class Producer extends ProducerConsumerBase { + +} diff --git a/src/test/java/com/rabbitmq/examples/perf/openstack/samples/Configuration.java b/src/test/java/com/rabbitmq/examples/perf/openstack/samples/Configuration.java new file mode 100644 index 0000000000..249023dae1 --- /dev/null +++ b/src/test/java/com/rabbitmq/examples/perf/openstack/samples/Configuration.java @@ -0,0 +1,66 @@ +package com.rabbitmq.examples.perf.openstack.samples; + +public class Configuration { + + //------------------------------------- + //AMQP messages sizes in Bytes + //Note: VN: Virtual Network, VM: Virtual Machine + //compute node published heartbeats (0 VN 0 VM): exchange originated + public static final int RPC_NOVA_OA_MEAN_SIZE = 1890; + public static final int RPC_NOVA_OCAV_MEAN_SIZE = 1890; + public static final int RPC_NOVA_SII_MEAN_SIZE = 1000; + public static final int RPC_NEUTRON_RS_MEAN_SIZE = 1530; + + //compute node consumed heartbeats: queue originated + public static final int RPC_NOVA_REPLY_MEAN_SIZE = 640; + public static final int RPC_NEUTRON_REPLY_MEAN_SIZE = 200; + + private static final int NBR_OF_VARIABLES = 6; + + //additional size when resources are deployed (1 VN 1 VM): exchange + public static final int RPC_NOVA_OA_ADD_SIZE = 110; + public static final int RPC_NOVA_OCAV_ADD_SIZE = 110; + public static final int RPC_NOVA_SII_ADD_SIZE = 210; + public static final int RPC_NEUTRON_RS_ADD_SIZE = 0; + + //additional size of queue originated messages + public static final int RPC_NOVA_REPLY_ADD_SIZE = 480; + public static final int RPC_NEUTRON_REPLY_ADD_SIZE = 40; + + //------------------------------------- + //POP (Point of Presence; i.e. Datacenter) simulation variables + //For example: the number of compute nodes in a POP. + private int nbr_cpun; + private int nbr_vn; + private int nbr_vm_cpun; +// private int nbr_vm_vn; +// private int nbr_cross_vn; + + public Configuration(int nbr_cpu_nodes_per_pop, int nbr_vn_per_pop, + int nbr_vm_per_cpu_node, int nbr_vm_per_vn, int nbr_cross_pop_vn) { + + nbr_cpun = nbr_cpu_nodes_per_pop; + nbr_vn = nbr_vn_per_pop; + nbr_vm_cpun = nbr_vm_per_cpu_node; +// nbr_vm_vn = nbr_vm_per_vn; +// nbr_cross_vn = nbr_cross_pop_vn; + + } + + public int[] getPopConfigMatrix() { + int[] config = new int[NBR_OF_VARIABLES]; + config[0] = RPC_NOVA_OA_MEAN_SIZE + RPC_NOVA_OA_ADD_SIZE * nbr_vm_cpun; + config[1] = RPC_NOVA_OCAV_MEAN_SIZE + RPC_NOVA_OCAV_ADD_SIZE * nbr_vm_cpun; + config[2] = RPC_NOVA_SII_MEAN_SIZE + RPC_NOVA_SII_ADD_SIZE * nbr_vm_cpun; + config[3] = RPC_NEUTRON_RS_MEAN_SIZE + RPC_NEUTRON_RS_ADD_SIZE * nbr_vn; + config[4] = RPC_NOVA_REPLY_MEAN_SIZE + RPC_NOVA_REPLY_ADD_SIZE * nbr_vm_cpun; + config[5] = RPC_NEUTRON_REPLY_MEAN_SIZE + RPC_NEUTRON_REPLY_ADD_SIZE * nbr_vn; + + for (int i = 0; i < config.length; i++) { + config[i] = config[i] * nbr_cpun; + } + + return config; + } + +} From 9fd23be829d4e4ca1ef942fba250967175585c93 Mon Sep 17 00:00:00 2001 From: ayoub Date: Tue, 9 Aug 2016 10:49:53 -0500 Subject: [PATCH 2/8] Remove Configuration and empty P/C classes. --- .../examples/perf/openstack/Consumer.java | 5 -- .../examples/perf/openstack/Producer.java | 14 ---- .../perf/openstack/samples/Configuration.java | 66 ------------------- 3 files changed, 85 deletions(-) delete mode 100644 src/test/java/com/rabbitmq/examples/perf/openstack/Consumer.java delete mode 100644 src/test/java/com/rabbitmq/examples/perf/openstack/Producer.java delete mode 100644 src/test/java/com/rabbitmq/examples/perf/openstack/samples/Configuration.java diff --git a/src/test/java/com/rabbitmq/examples/perf/openstack/Consumer.java b/src/test/java/com/rabbitmq/examples/perf/openstack/Consumer.java deleted file mode 100644 index b372182a79..0000000000 --- a/src/test/java/com/rabbitmq/examples/perf/openstack/Consumer.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.rabbitmq.examples.perf.openstack; - -public class Consumer { - -} diff --git a/src/test/java/com/rabbitmq/examples/perf/openstack/Producer.java b/src/test/java/com/rabbitmq/examples/perf/openstack/Producer.java deleted file mode 100644 index 4ecaa536cc..0000000000 --- a/src/test/java/com/rabbitmq/examples/perf/openstack/Producer.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.rabbitmq.examples.perf.openstack; - -import com.rabbitmq.examples.perf.ProducerConsumerBase; - -/* - * This producer will publish OpenStack-alike messages to the RabbitMQ server. - * These messages simulate the OpenStack heartbeats, in particular, those that - * are used by Nova and Neutron modules to update N-CPU, L2, L3 and DHCP agents' - * status. - */ - -public class Producer extends ProducerConsumerBase { - -} diff --git a/src/test/java/com/rabbitmq/examples/perf/openstack/samples/Configuration.java b/src/test/java/com/rabbitmq/examples/perf/openstack/samples/Configuration.java deleted file mode 100644 index 249023dae1..0000000000 --- a/src/test/java/com/rabbitmq/examples/perf/openstack/samples/Configuration.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.rabbitmq.examples.perf.openstack.samples; - -public class Configuration { - - //------------------------------------- - //AMQP messages sizes in Bytes - //Note: VN: Virtual Network, VM: Virtual Machine - //compute node published heartbeats (0 VN 0 VM): exchange originated - public static final int RPC_NOVA_OA_MEAN_SIZE = 1890; - public static final int RPC_NOVA_OCAV_MEAN_SIZE = 1890; - public static final int RPC_NOVA_SII_MEAN_SIZE = 1000; - public static final int RPC_NEUTRON_RS_MEAN_SIZE = 1530; - - //compute node consumed heartbeats: queue originated - public static final int RPC_NOVA_REPLY_MEAN_SIZE = 640; - public static final int RPC_NEUTRON_REPLY_MEAN_SIZE = 200; - - private static final int NBR_OF_VARIABLES = 6; - - //additional size when resources are deployed (1 VN 1 VM): exchange - public static final int RPC_NOVA_OA_ADD_SIZE = 110; - public static final int RPC_NOVA_OCAV_ADD_SIZE = 110; - public static final int RPC_NOVA_SII_ADD_SIZE = 210; - public static final int RPC_NEUTRON_RS_ADD_SIZE = 0; - - //additional size of queue originated messages - public static final int RPC_NOVA_REPLY_ADD_SIZE = 480; - public static final int RPC_NEUTRON_REPLY_ADD_SIZE = 40; - - //------------------------------------- - //POP (Point of Presence; i.e. Datacenter) simulation variables - //For example: the number of compute nodes in a POP. - private int nbr_cpun; - private int nbr_vn; - private int nbr_vm_cpun; -// private int nbr_vm_vn; -// private int nbr_cross_vn; - - public Configuration(int nbr_cpu_nodes_per_pop, int nbr_vn_per_pop, - int nbr_vm_per_cpu_node, int nbr_vm_per_vn, int nbr_cross_pop_vn) { - - nbr_cpun = nbr_cpu_nodes_per_pop; - nbr_vn = nbr_vn_per_pop; - nbr_vm_cpun = nbr_vm_per_cpu_node; -// nbr_vm_vn = nbr_vm_per_vn; -// nbr_cross_vn = nbr_cross_pop_vn; - - } - - public int[] getPopConfigMatrix() { - int[] config = new int[NBR_OF_VARIABLES]; - config[0] = RPC_NOVA_OA_MEAN_SIZE + RPC_NOVA_OA_ADD_SIZE * nbr_vm_cpun; - config[1] = RPC_NOVA_OCAV_MEAN_SIZE + RPC_NOVA_OCAV_ADD_SIZE * nbr_vm_cpun; - config[2] = RPC_NOVA_SII_MEAN_SIZE + RPC_NOVA_SII_ADD_SIZE * nbr_vm_cpun; - config[3] = RPC_NEUTRON_RS_MEAN_SIZE + RPC_NEUTRON_RS_ADD_SIZE * nbr_vn; - config[4] = RPC_NOVA_REPLY_MEAN_SIZE + RPC_NOVA_REPLY_ADD_SIZE * nbr_vm_cpun; - config[5] = RPC_NEUTRON_REPLY_MEAN_SIZE + RPC_NEUTRON_REPLY_ADD_SIZE * nbr_vn; - - for (int i = 0; i < config.length; i++) { - config[i] = config[i] * nbr_cpun; - } - - return config; - } - -} From d1c4b17a3837f32c665efc767c195a9e4f8f3267 Mon Sep 17 00:00:00 2001 From: ayoub Date: Mon, 22 Aug 2016 07:23:42 -0500 Subject: [PATCH 3/8] Add an ID to PerfTest output. --- src/test/java/com/rabbitmq/examples/PerfTest.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/test/java/com/rabbitmq/examples/PerfTest.java b/src/test/java/com/rabbitmq/examples/PerfTest.java index e65c057ed4..1244044500 100644 --- a/src/test/java/com/rabbitmq/examples/PerfTest.java +++ b/src/test/java/com/rabbitmq/examples/PerfTest.java @@ -15,7 +15,9 @@ package com.rabbitmq.examples; +import java.text.SimpleDateFormat; import java.util.Arrays; +import java.util.Calendar; import java.util.List; import com.rabbitmq.examples.perf.MulticastParams; @@ -33,6 +35,9 @@ public class PerfTest { + + private static String testID; + public static void main(String[] args) { Options options = getOptions(); CommandLineParser parser = new GnuParser(); @@ -43,7 +48,9 @@ public static void main(String[] args) { usage(options); System.exit(0); } - + testID = new SimpleDateFormat("HH:mm:ss.SSS").format(Calendar. + getInstance().getTime()); + testID = strArg(cmd, 'd', "test-" + testID); String exchangeType = strArg(cmd, 't', "direct"); String exchangeName = strArg(cmd, 'e', exchangeType); String queueName = strArg(cmd, 'u', ""); @@ -135,6 +142,7 @@ private static void usage(Options options) { private static Options getOptions() { Options options = new Options(); options.addOption(new Option("?", "help", false,"show usage")); + options.addOption(new Option("d", "id", true, "Test ID")); options.addOption(new Option("h", "uri", true, "connection URI")); options.addOption(new Option("t", "type", true, "exchange type")); options.addOption(new Option("e", "exchange", true, "exchange name")); @@ -204,6 +212,7 @@ public PrintlnStats(long interval, @Override protected void report(long now) { + System.out.print("id: " + testID + ", "); System.out.print("time: " + String.format("%.3f", (now - startTime)/1000.0) + "s"); showRate("sent", sendCountInterval, sendStatsEnabled, elapsedInterval); From 6d44cbf4553b2f2dccb5d6019d5c245ac1ae56ce Mon Sep 17 00:00:00 2001 From: ayoub Date: Mon, 22 Aug 2016 11:22:23 -0500 Subject: [PATCH 4/8] Update test ID declaration. --- .../java/com/rabbitmq/examples/PerfTest.java | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/test/java/com/rabbitmq/examples/PerfTest.java b/src/test/java/com/rabbitmq/examples/PerfTest.java index 1244044500..5a177a2aac 100644 --- a/src/test/java/com/rabbitmq/examples/PerfTest.java +++ b/src/test/java/com/rabbitmq/examples/PerfTest.java @@ -36,8 +36,6 @@ public class PerfTest { - private static String testID; - public static void main(String[] args) { Options options = getOptions(); CommandLineParser parser = new GnuParser(); @@ -48,9 +46,9 @@ public static void main(String[] args) { usage(options); System.exit(0); } - testID = new SimpleDateFormat("HH:mm:ss.SSS").format(Calendar. + String testID = new SimpleDateFormat("HHmmss-SSS").format(Calendar. getInstance().getTime()); - testID = strArg(cmd, 'd', "test-" + testID); + testID = strArg(cmd, 'd', "test-"+testID); String exchangeType = strArg(cmd, 't', "direct"); String exchangeName = strArg(cmd, 'e', exchangeType); String queueName = strArg(cmd, 'u', ""); @@ -80,12 +78,13 @@ public static void main(String[] args) { String uri = strArg(cmd, 'h', "amqp://localhost"); //setup - PrintlnStats stats = new PrintlnStats(1000L * samplingInterval, - producerCount > 0, - consumerCount > 0, - (flags.contains("mandatory") || - flags.contains("immediate")), - confirm != -1); + PrintlnStats stats = new PrintlnStats(testID, + 1000L * samplingInterval, + producerCount > 0, + consumerCount > 0, + (flags.contains("mandatory") || + flags.contains("immediate")), + confirm != -1); ConnectionFactory factory = new ConnectionFactory(); factory.setShutdownTimeout(0); // So we still shut down even with slow consumers @@ -199,8 +198,10 @@ private static class PrintlnStats extends Stats { private final boolean recvStatsEnabled; private final boolean returnStatsEnabled; private final boolean confirmStatsEnabled; + + private final String testID; - public PrintlnStats(long interval, + public PrintlnStats(String testID, long interval, boolean sendStatsEnabled, boolean recvStatsEnabled, boolean returnStatsEnabled, boolean confirmStatsEnabled) { super(interval); @@ -208,11 +209,13 @@ public PrintlnStats(long interval, this.recvStatsEnabled = recvStatsEnabled; this.returnStatsEnabled = returnStatsEnabled; this.confirmStatsEnabled = confirmStatsEnabled; + this.testID = testID; } @Override protected void report(long now) { System.out.print("id: " + testID + ", "); + System.out.print("time: " + String.format("%.3f", (now - startTime)/1000.0) + "s"); showRate("sent", sendCountInterval, sendStatsEnabled, elapsedInterval); From e57d3f039b55eca2748e7509699e19e8a5a1a740 Mon Sep 17 00:00:00 2001 From: ayoub Date: Mon, 22 Aug 2016 11:46:44 -0500 Subject: [PATCH 5/8] Update PerfTest System.out. --- .../java/com/rabbitmq/examples/PerfTest.java | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/src/test/java/com/rabbitmq/examples/PerfTest.java b/src/test/java/com/rabbitmq/examples/PerfTest.java index 5a177a2aac..4e44c2bf89 100644 --- a/src/test/java/com/rabbitmq/examples/PerfTest.java +++ b/src/test/java/com/rabbitmq/examples/PerfTest.java @@ -214,31 +214,32 @@ public PrintlnStats(String testID, long interval, @Override protected void report(long now) { - System.out.print("id: " + testID + ", "); + String output = "id: " + testID + ", "; - System.out.print("time: " + String.format("%.3f", (now - startTime)/1000.0) + "s"); + output += "time: " + String.format("%.3f", (now - startTime)/1000.0) + "s"; + output += + showRate("sent", sendCountInterval, sendStatsEnabled, elapsedInterval) + + showRate("returned", returnCountInterval, sendStatsEnabled && returnStatsEnabled, elapsedInterval) + + showRate("confirmed", confirmCountInterval, sendStatsEnabled && confirmStatsEnabled, elapsedInterval) + + showRate("nacked", nackCountInterval, sendStatsEnabled && confirmStatsEnabled, elapsedInterval) + + showRate("received", recvCountInterval, recvStatsEnabled, elapsedInterval); - showRate("sent", sendCountInterval, sendStatsEnabled, elapsedInterval); - showRate("returned", returnCountInterval, sendStatsEnabled && returnStatsEnabled, elapsedInterval); - showRate("confirmed", confirmCountInterval, sendStatsEnabled && confirmStatsEnabled, elapsedInterval); - showRate("nacked", nackCountInterval, sendStatsEnabled && confirmStatsEnabled, elapsedInterval); - showRate("received", recvCountInterval, recvStatsEnabled, elapsedInterval); - - System.out.print((latencyCountInterval > 0 ? + output += (latencyCountInterval > 0 ? ", min/avg/max latency: " + minLatency/1000L + "/" + cumulativeLatencyInterval / (1000L * latencyCountInterval) + "/" + maxLatency/1000L + " microseconds" : - "")); + ""); - System.out.println(); + System.out.println(output); } - private void showRate(String descr, long count, boolean display, + private String showRate(String descr, long count, boolean display, long elapsed) { - if (display) { - System.out.print(", " + descr + ": " + formatRate(1000.0 * count / elapsed) + " msg/s"); - } + if (display) + return ", " + descr + ": " + formatRate(1000.0 * count / elapsed) + " msg/s"; + else + return ""; } public void printFinal() { From 686a033ef88b3f4b95176e1f610950852835b093 Mon Sep 17 00:00:00 2001 From: ayoub Date: Tue, 23 Aug 2016 04:55:30 -0500 Subject: [PATCH 6/8] Correction of an identation mistake. --- src/test/java/com/rabbitmq/examples/PerfTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/com/rabbitmq/examples/PerfTest.java b/src/test/java/com/rabbitmq/examples/PerfTest.java index 4e44c2bf89..dec52632bb 100644 --- a/src/test/java/com/rabbitmq/examples/PerfTest.java +++ b/src/test/java/com/rabbitmq/examples/PerfTest.java @@ -48,7 +48,7 @@ public static void main(String[] args) { } String testID = new SimpleDateFormat("HHmmss-SSS").format(Calendar. getInstance().getTime()); - testID = strArg(cmd, 'd', "test-"+testID); + testID = strArg(cmd, 'd', "test-"+testID); String exchangeType = strArg(cmd, 't', "direct"); String exchangeName = strArg(cmd, 'e', exchangeType); String queueName = strArg(cmd, 'u', ""); From 4995878ff147b8e02eb2b6960b786ef46a64ce01 Mon Sep 17 00:00:00 2001 From: ayoub Date: Tue, 23 Aug 2016 11:25:25 -0500 Subject: [PATCH 7/8] Change showRate to getRate. --- src/test/java/com/rabbitmq/examples/PerfTest.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/test/java/com/rabbitmq/examples/PerfTest.java b/src/test/java/com/rabbitmq/examples/PerfTest.java index dec52632bb..25add55314 100644 --- a/src/test/java/com/rabbitmq/examples/PerfTest.java +++ b/src/test/java/com/rabbitmq/examples/PerfTest.java @@ -218,11 +218,11 @@ protected void report(long now) { output += "time: " + String.format("%.3f", (now - startTime)/1000.0) + "s"; output += - showRate("sent", sendCountInterval, sendStatsEnabled, elapsedInterval) + - showRate("returned", returnCountInterval, sendStatsEnabled && returnStatsEnabled, elapsedInterval) + - showRate("confirmed", confirmCountInterval, sendStatsEnabled && confirmStatsEnabled, elapsedInterval) + - showRate("nacked", nackCountInterval, sendStatsEnabled && confirmStatsEnabled, elapsedInterval) + - showRate("received", recvCountInterval, recvStatsEnabled, elapsedInterval); + getRate("sent", sendCountInterval, sendStatsEnabled, elapsedInterval) + + getRate("returned", returnCountInterval, sendStatsEnabled && returnStatsEnabled, elapsedInterval) + + getRate("confirmed", confirmCountInterval, sendStatsEnabled && confirmStatsEnabled, elapsedInterval) + + getRate("nacked", nackCountInterval, sendStatsEnabled && confirmStatsEnabled, elapsedInterval) + + getRate("received", recvCountInterval, recvStatsEnabled, elapsedInterval); output += (latencyCountInterval > 0 ? ", min/avg/max latency: " + @@ -234,7 +234,7 @@ protected void report(long now) { System.out.println(output); } - private String showRate(String descr, long count, boolean display, + private String getRate(String descr, long count, boolean display, long elapsed) { if (display) return ", " + descr + ": " + formatRate(1000.0 * count / elapsed) + " msg/s"; From 56686aea51bbe9d729a36b4c2142dbcc4aa3449b Mon Sep 17 00:00:00 2001 From: ayoub Date: Tue, 23 Aug 2016 11:28:35 -0500 Subject: [PATCH 8/8] Correct indentation mistake. --- src/test/java/com/rabbitmq/examples/PerfTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/com/rabbitmq/examples/PerfTest.java b/src/test/java/com/rabbitmq/examples/PerfTest.java index 25add55314..99a93ce267 100644 --- a/src/test/java/com/rabbitmq/examples/PerfTest.java +++ b/src/test/java/com/rabbitmq/examples/PerfTest.java @@ -218,7 +218,7 @@ protected void report(long now) { output += "time: " + String.format("%.3f", (now - startTime)/1000.0) + "s"; output += - getRate("sent", sendCountInterval, sendStatsEnabled, elapsedInterval) + + getRate("sent", sendCountInterval, sendStatsEnabled, elapsedInterval) + getRate("returned", returnCountInterval, sendStatsEnabled && returnStatsEnabled, elapsedInterval) + getRate("confirmed", confirmCountInterval, sendStatsEnabled && confirmStatsEnabled, elapsedInterval) + getRate("nacked", nackCountInterval, sendStatsEnabled && confirmStatsEnabled, elapsedInterval) +