summaryrefslogtreecommitdiffstats
path: root/infra/it/memory-benchmark/src/main/java/io/fd/honeycomb/benchmark/memory/MemoryInfo.java
diff options
context:
space:
mode:
authorJan Srnicek <jsrnicek@cisco.com>2017-01-31 10:00:51 +0100
committerJan Srnicek <jsrnicek@cisco.com>2017-01-31 10:00:51 +0100
commit92afaeb4a959ea5a6a072fe3ed7a01088d703e0b (patch)
treefc98660011e75ca71f97c25e641638dce37158bd /infra/it/memory-benchmark/src/main/java/io/fd/honeycomb/benchmark/memory/MemoryInfo.java
parent60e463b17b05458c1f9a7fd72f9e99d71124eedf (diff)
HONEYCOMB-293 - Memory benchmarking
Contains configuration for benchmarks: - Honeycomb on rest(just infra, no data) - Honeycomb with 1000 data nodes - Honeycomb with 10000 data nodes Each benchmark outputs two files: - out_path_name-HeapMemoryUsage.csv - out_path_name-NonHeapMemoryUsage.csv Both files are in format : committed,init,max,used 109576192,109051904,1525153792,12194752 Data sample sizes can be easily adjusted, just by changing start parameter -DsampleSize Change-Id: If6f9919307574237689326b4a38d410ec563200a Signed-off-by: Marek Gradzki <mgradzki@cisco.com> Signed-off-by: Jan Srnicek <jsrnicek@cisco.com>
Diffstat (limited to 'infra/it/memory-benchmark/src/main/java/io/fd/honeycomb/benchmark/memory/MemoryInfo.java')
-rw-r--r--infra/it/memory-benchmark/src/main/java/io/fd/honeycomb/benchmark/memory/MemoryInfo.java87
1 files changed, 87 insertions, 0 deletions
diff --git a/infra/it/memory-benchmark/src/main/java/io/fd/honeycomb/benchmark/memory/MemoryInfo.java b/infra/it/memory-benchmark/src/main/java/io/fd/honeycomb/benchmark/memory/MemoryInfo.java
new file mode 100644
index 000000000..f79006f78
--- /dev/null
+++ b/infra/it/memory-benchmark/src/main/java/io/fd/honeycomb/benchmark/memory/MemoryInfo.java
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2017 Cisco and/or its affiliates.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.fd.honeycomb.benchmark.memory;
+
+import javax.annotation.Nonnull;
+import javax.management.openmbean.CompositeDataSupport;
+import java.util.Arrays;
+
+import static com.google.common.base.Preconditions.checkArgument;
+
+/**
+ * Wrapped from data extracted from JMX beans of type Memory
+ * */
+public final class MemoryInfo {
+
+ public static final String MEMORY_MBEAN_TYPE = "java.lang:type=Memory";
+ public static final String HEAP_MEMORY = "HeapMemoryUsage";
+ public static final String NON_HEAP_MEMORY = "NonHeapMemoryUsage";
+
+ public static final String COMMITTED = "committed";
+ public static final String INIT = "init";
+ public static final String MAX = "max";
+ public static final String USED = "used";
+
+ private final String memoryInfoTypeName;
+ private final long committed, init, max, used;
+
+ public MemoryInfo(@Nonnull final CompositeDataSupport compositeData, @Nonnull final String memoryInfoTypeName) {
+ checkArgument(compositeData.getCompositeType().keySet().containsAll(Arrays.asList(COMMITTED, INIT, MAX, USED)),
+ "Submitted composite data %s does not contains necessary attributes", compositeData);
+ this.memoryInfoTypeName = memoryInfoTypeName;
+ this.committed = compositeDataAttributeValue(compositeData.get(COMMITTED));
+ this.init = compositeDataAttributeValue(compositeData.get(INIT));
+ this.max = compositeDataAttributeValue(compositeData.get(MAX));
+ this.used = compositeDataAttributeValue(compositeData.get(USED));
+
+ }
+
+ public String getMemoryInfoTypeName() {
+ return memoryInfoTypeName;
+ }
+
+ public long getCommitted() {
+ return committed;
+ }
+
+ public long getInit() {
+ return init;
+ }
+
+ public long getMax() {
+ return max;
+ }
+
+ public long getUsed() {
+ return used;
+ }
+
+ @Override
+ public String toString() {
+ return memoryInfoTypeName + "[" +
+ "committed=" + committed +
+ ",init=" + init +
+ ",max=" + max +
+ ",used=" + used +
+ ']';
+ }
+
+ private static Long compositeDataAttributeValue(final Object commited) {
+ checkArgument(commited instanceof Long, "Unsupported memory attribute value %s", commited.getClass());
+ return Long.class.cast(commited);
+ }
+}