From 7d7ba8f5cd0c6d23fa5dd8fdf000fa7c46dd6364 Mon Sep 17 00:00:00 2001 From: Kelly Kostopoulou Date: Thu, 18 Jul 2024 20:56:49 +0000 Subject: [PATCH 1/5] added more metrics --- .../collectors/monitoring/MySQLMonitor.java | 42 +++++++++++++++---- 1 file changed, 33 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/oltpbenchmark/api/collectors/monitoring/MySQLMonitor.java b/src/main/java/com/oltpbenchmark/api/collectors/monitoring/MySQLMonitor.java index 295c4eed8..b1fe8cb9c 100644 --- a/src/main/java/com/oltpbenchmark/api/collectors/monitoring/MySQLMonitor.java +++ b/src/main/java/com/oltpbenchmark/api/collectors/monitoring/MySQLMonitor.java @@ -14,10 +14,6 @@ import java.util.List; import java.util.Map; -/** - * Implementation of a monitor specific to PostgreSQL. Uses the 'pg_stat_statements' add-on to - * extract relevant query and system information. - */ public class MySQLMonitor extends DatabaseMonitor { // TODO: add support for per-query metrics using performance_schema @@ -37,11 +33,39 @@ public MySQLMonitor( this.repeatedSystemProperties = new ArrayList() { { - add("bytes_received"); - add("bytes_sent"); - add("com_select"); - // ... - // TODO: Add more properties from SHOW STATUS here + add("Connections"); + add("Threads_running"); + add("Threads_connected"); + add("Handler_write"); + add("Handler_commit"); + add("Handler_update"); + add("Handler_delete"); + add("Handler_read_next"); + add("Com_select"); + add("Com_insert"); + add("Com_insert_select"); + add("Com_update"); + add("Com_delete"); + add("Select_full_join"); + add("Select_full_range_join"); + add("Select_range"); + add("Select_range_check"); + add("Select_scan"); + add("Innodb_data_reads"); + add("Innodb_data_writes"); + add("Innodb_data_read"); + add("Innodb_data_written"); + add("Innodb_rows_deleted"); + add("Innodb_rows_inserted"); + add("Innodb_rows_read"); + add("Innodb_rows_updated"); + add("Innodb_buffer_pool_read_requests"); + add("Sort_merge_passes"); + add("Sort_range"); + add("Sort_rows"); + add("Sort_scan"); + add("Bytes_received"); + add("Bytes_sent"); } }; } From 3768eedcebb123bec65905091451ece0f9f1cc56 Mon Sep 17 00:00:00 2001 From: Kelly Kostopoulou Date: Fri, 19 Jul 2024 05:28:57 +0000 Subject: [PATCH 2/5] logging start time after warmup --- src/main/java/com/oltpbenchmark/Results.java | 9 +++++++++ src/main/java/com/oltpbenchmark/ThreadBench.java | 3 +++ src/main/java/com/oltpbenchmark/util/ResultWriter.java | 2 ++ 3 files changed, 14 insertions(+) diff --git a/src/main/java/com/oltpbenchmark/Results.java b/src/main/java/com/oltpbenchmark/Results.java index 335a49dc7..8b2a1f5d4 100644 --- a/src/main/java/com/oltpbenchmark/Results.java +++ b/src/main/java/com/oltpbenchmark/Results.java @@ -29,6 +29,7 @@ public final class Results { private final State state; private final long startTimestampMs; + private final long startTimestampAfterWarmUpMs; private final long nanoseconds; private final int measuredRequests; private final DistributionStatistics distributionStatistics; @@ -44,11 +45,13 @@ public final class Results { public Results( State state, long startTimestampMs, + long startTimestampAfterWarmUpMs, long elapsedNanoseconds, int measuredRequests, DistributionStatistics distributionStatistics, final List latencySamples) { this.startTimestampMs = startTimestampMs; + this.startTimestampAfterWarmUpMs = startTimestampAfterWarmUpMs; this.nanoseconds = elapsedNanoseconds; this.measuredRequests = measuredRequests; this.distributionStatistics = distributionStatistics; @@ -114,6 +117,10 @@ public long getStartTimestampMs() { return startTimestampMs; } + public long getStartTimestampAfterWarmUpMs() { + return startTimestampAfterWarmUpMs; + } + public long getNanoseconds() { return nanoseconds; } @@ -129,6 +136,8 @@ public String toString() { sb.append(state); sb.append(", nanoSeconds="); sb.append(nanoseconds); + sb.append(", startTimestampAfterWarmUpNs="); + sb.append(startTimestampAfterWarmUpMs); sb.append(", measuredRequests="); sb.append(measuredRequests); sb.append(") = "); diff --git a/src/main/java/com/oltpbenchmark/ThreadBench.java b/src/main/java/com/oltpbenchmark/ThreadBench.java index 4f1cb93ac..caefaac41 100644 --- a/src/main/java/com/oltpbenchmark/ThreadBench.java +++ b/src/main/java/com/oltpbenchmark/ThreadBench.java @@ -148,6 +148,7 @@ private Results runRateLimitedMultiPhase() { long start = System.nanoTime(); long warmupStart = System.nanoTime(); long warmup = warmupStart; + long startTsAfterWarmUp = startTs; long measureEnd = -1; long intervalNs = getInterval(lowestRate, phase.getArrival()); @@ -291,6 +292,7 @@ private Results runRateLimitedMultiPhase() { } interruptWorkers(); } + startTsAfterWarmUp += (now - start) / 1000000; start = now; LOG.info("{} :: Warmup complete, starting measurements.", StringUtil.bold("MEASURE")); // measureEnd = measureStart + measureSeconds * 1000000000L; @@ -346,6 +348,7 @@ private Results runRateLimitedMultiPhase() { // final Results state so we can exit non-zero *after* we output the results. errorsThrown ? State.ERROR : testState.getState(), startTs, + startTsAfterWarmUp, measureEnd - start, requests, stats, diff --git a/src/main/java/com/oltpbenchmark/util/ResultWriter.java b/src/main/java/com/oltpbenchmark/util/ResultWriter.java index d698994d1..1fe20a30f 100644 --- a/src/main/java/com/oltpbenchmark/util/ResultWriter.java +++ b/src/main/java/com/oltpbenchmark/util/ResultWriter.java @@ -89,6 +89,8 @@ public void writeSummary(PrintStream os) { Date now = new Date(); summaryMap.put("Start timestamp (milliseconds)", results.getStartTimestampMs()); summaryMap.put("Current Timestamp (milliseconds)", now.getTime()); + summaryMap.put( + "Start timestamp after warmup (milliseconds)", results.getStartTimestampAfterWarmUpMs()); summaryMap.put("Elapsed Time (nanoseconds)", results.getNanoseconds()); summaryMap.put("DBMS Type", dbType); summaryMap.put("DBMS Version", collector.collectVersion()); From c16cd2d5cdf87be10cb068f55bbb959284c79458 Mon Sep 17 00:00:00 2001 From: Kelly Kostopoulou Date: Fri, 19 Jul 2024 05:30:10 +0000 Subject: [PATCH 3/5] fixed bug in writing repeated system events --- .../api/collectors/monitoring/DatabaseMonitor.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/com/oltpbenchmark/api/collectors/monitoring/DatabaseMonitor.java b/src/main/java/com/oltpbenchmark/api/collectors/monitoring/DatabaseMonitor.java index 3706d14c5..87c7b608f 100644 --- a/src/main/java/com/oltpbenchmark/api/collectors/monitoring/DatabaseMonitor.java +++ b/src/main/java/com/oltpbenchmark/api/collectors/monitoring/DatabaseMonitor.java @@ -171,8 +171,7 @@ protected void writeRepeatedSystemEventsToCSV() { out.println( event.getInstant().toString() + "," - + StringUtil.join( - ",", this.repeatedSystemEvents.get(0).getPropertyValues().values())); + + StringUtil.join(",", event.getPropertyValues().values())); } out.close(); this.repeatedSystemEvents = new ArrayList<>(); From 0f3705770709e2c4019c5241e63fded54b90ade3 Mon Sep 17 00:00:00 2001 From: Kelly Kostopoulou Date: Wed, 24 Jul 2024 21:48:01 +0000 Subject: [PATCH 4/5] added more metrics --- .../api/collectors/monitoring/MySQLMonitor.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/oltpbenchmark/api/collectors/monitoring/MySQLMonitor.java b/src/main/java/com/oltpbenchmark/api/collectors/monitoring/MySQLMonitor.java index b1fe8cb9c..db0acf13e 100644 --- a/src/main/java/com/oltpbenchmark/api/collectors/monitoring/MySQLMonitor.java +++ b/src/main/java/com/oltpbenchmark/api/collectors/monitoring/MySQLMonitor.java @@ -19,7 +19,7 @@ public class MySQLMonitor extends DatabaseMonitor { // TODO: add support for per-query metrics using performance_schema // TODO: Expand to SHOW ENGINE INNODB STATUS as well? - private final String MYSQL_SYSTEM_METRICS = "SHOW GLOBAL STATUS;"; + private final String MYSQL_SYSTEM_METRICS = "show global status like '%';"; private final List repeatedSystemProperties; @@ -36,11 +36,13 @@ public MySQLMonitor( add("Connections"); add("Threads_running"); add("Threads_connected"); + add("Threads_created"); add("Handler_write"); add("Handler_commit"); add("Handler_update"); add("Handler_delete"); add("Handler_read_next"); + add("Com_create_table"); add("Com_select"); add("Com_insert"); add("Com_insert_select"); @@ -60,6 +62,8 @@ public MySQLMonitor( add("Innodb_rows_read"); add("Innodb_rows_updated"); add("Innodb_buffer_pool_read_requests"); + add("Innodb_buffer_pool_write_requests"); + add("Innodb_buffer_pool_reads"); add("Sort_merge_passes"); add("Sort_range"); add("Sort_rows"); From 164cc5baf94dadd5a743d8fdc525206c005ea5ab Mon Sep 17 00:00:00 2001 From: Kelly Kostopoulou Date: Wed, 24 Jul 2024 21:53:58 +0000 Subject: [PATCH 5/5] minor typo --- src/main/java/com/oltpbenchmark/Results.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/oltpbenchmark/Results.java b/src/main/java/com/oltpbenchmark/Results.java index 8b2a1f5d4..04138abaa 100644 --- a/src/main/java/com/oltpbenchmark/Results.java +++ b/src/main/java/com/oltpbenchmark/Results.java @@ -136,7 +136,7 @@ public String toString() { sb.append(state); sb.append(", nanoSeconds="); sb.append(nanoseconds); - sb.append(", startTimestampAfterWarmUpNs="); + sb.append(", startTimestampAfterWarmUpMs="); sb.append(startTimestampAfterWarmUpMs); sb.append(", measuredRequests="); sb.append(measuredRequests);