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

minor modifications #9

Open
wants to merge 5 commits into
base: mysql-advanced-monitoring
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/main/java/com/oltpbenchmark/Results.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -44,11 +45,13 @@ public final class Results {
public Results(
State state,
long startTimestampMs,
long startTimestampAfterWarmUpMs,
long elapsedNanoseconds,
int measuredRequests,
DistributionStatistics distributionStatistics,
final List<LatencyRecord.Sample> latencySamples) {
this.startTimestampMs = startTimestampMs;
this.startTimestampAfterWarmUpMs = startTimestampAfterWarmUpMs;
this.nanoseconds = elapsedNanoseconds;
this.measuredRequests = measuredRequests;
this.distributionStatistics = distributionStatistics;
Expand Down Expand Up @@ -114,6 +117,10 @@ public long getStartTimestampMs() {
return startTimestampMs;
}

public long getStartTimestampAfterWarmUpMs() {
return startTimestampAfterWarmUpMs;
}

public long getNanoseconds() {
return nanoseconds;
}
Expand All @@ -129,6 +136,8 @@ public String toString() {
sb.append(state);
sb.append(", nanoSeconds=");
sb.append(nanoseconds);
sb.append(", startTimestampAfterWarmUpMs=");
sb.append(startTimestampAfterWarmUpMs);
sb.append(", measuredRequests=");
sb.append(measuredRequests);
sb.append(") = ");
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/com/oltpbenchmark/ThreadBench.java
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,12 @@
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

// 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<String> repeatedSystemProperties;

Expand All @@ -37,11 +33,43 @@ public MySQLMonitor(
this.repeatedSystemProperties =
new ArrayList<String>() {
{
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("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");
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("Innodb_buffer_pool_write_requests");
add("Innodb_buffer_pool_reads");
add("Sort_merge_passes");
add("Sort_range");
add("Sort_rows");
add("Sort_scan");
add("Bytes_received");
add("Bytes_sent");
}
};
}
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/oltpbenchmark/util/ResultWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down