You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ns...@apache.org on 2011/10/11 04:12:58 UTC
svn commit: r1181489 - in
/hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver:
metrics/RegionServerMetrics.java wal/HLog.java
Author: nspiegelberg
Date: Tue Oct 11 02:12:57 2011
New Revision: 1181489
URL: http://svn.apache.org/viewvc?rev=1181489&view=rev
Log:
More JMX Metrics for Write Path
Summary:
added more metrics to analyze write path latency. will not be
checked in. just for analysis
Test Plan:
dev cluster tests
DiffCamp Revision: 215250
Reviewed By: kannan
Reviewers: kannan
CC: kannan
Revert Plan:
OK
Modified:
hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerMetrics.java
hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLog.java
Modified: hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerMetrics.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerMetrics.java?rev=1181489&r1=1181488&r2=1181489&view=diff
==============================================================================
--- hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerMetrics.java (original)
+++ hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerMetrics.java Tue Oct 11 02:12:57 2011
@@ -150,6 +150,12 @@ public class RegionServerMetrics impleme
new MetricsTimeVaryingRate("fsSyncLatency", registry);
/**
+ * filesystem group sync latency
+ */
+ public final MetricsTimeVaryingRate fsGroupSyncLatency =
+ new MetricsTimeVaryingRate("fsGroupSyncLatency", registry);
+
+ /**
* time each scheduled compaction takes
*/
protected final PersistentMetricsTimeVaryingRate compactionTime =
@@ -247,6 +253,8 @@ public class RegionServerMetrics impleme
}
ops = HLog.getSyncOps();
if (ops != 0) this.fsSyncLatency.inc(ops, HLog.getSyncTime());
+ ops = HLog.getGSyncOps();
+ if (ops != 0) this.fsGroupSyncLatency.inc(ops, HLog.getGSyncTime());
// HFile metrics
ops = HFile.getReadOps();
if (ops != 0) this.fsReadLatency.inc(ops, HFile.getReadTime());
@@ -261,6 +269,7 @@ public class RegionServerMetrics impleme
this.fsReadLatency.pushMetric(this.metricsRecord);
this.fsWriteLatency.pushMetric(this.metricsRecord);
this.fsSyncLatency.pushMetric(this.metricsRecord);
+ this.fsGroupSyncLatency.pushMetric(this.metricsRecord);
this.compactionTime.pushMetric(this.metricsRecord);
this.compactionSize.pushMetric(this.metricsRecord);
this.flushTime.pushMetric(this.metricsRecord);
@@ -274,6 +283,7 @@ public class RegionServerMetrics impleme
this.fsReadLatency.resetMinMax();
this.fsWriteLatency.resetMinMax();
this.fsSyncLatency.resetMinMax();
+ this.fsGroupSyncLatency.resetMinMax();
}
/**
Modified: hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLog.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLog.java?rev=1181489&r1=1181488&r2=1181489&view=diff
==============================================================================
--- hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLog.java (original)
+++ hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLog.java Tue Oct 11 02:12:57 2011
@@ -249,12 +249,14 @@ public class HLog implements Syncable {
}
// For measuring latency of writes
- private static volatile int writeOps;
- private static volatile long writeTime;
- private static volatile long writeSize;
+ private static volatile int writeOps = 0;
+ private static volatile long writeTime = 0;
+ private static volatile long writeSize = 0;
// For measuring latency of syncs
- private static volatile int syncOps;
- private static volatile long syncTime;
+ private static volatile int syncOps = 0;
+ private static volatile long syncTime = 0;
+ private static volatile int gsyncOps = 0;
+ private static volatile long gsyncTime = 0;
public static volatile long lastSplitTime = 0;
public static volatile long lastSplitSize = 0;
@@ -289,6 +291,18 @@ public class HLog implements Syncable {
return ret;
}
+ public static int getGSyncOps() {
+ int ret = gsyncOps;
+ gsyncOps = 0;
+ return ret;
+ }
+
+ public static long getGSyncTime() {
+ long ret = gsyncTime;
+ gsyncTime = 0;
+ return ret;
+ }
+
/**
* HLog creating with a null actions listener.
*
@@ -846,6 +860,7 @@ public class HLog implements Syncable {
if (this.closed) {
throw new IOException("Cannot append; log is closed");
}
+ long start = System.currentTimeMillis();
synchronized (this.updateLock) {
long seqNum = obtainSeqNum();
// The 'lastSeqWritten' map holds the sequence number of the oldest
@@ -861,8 +876,15 @@ public class HLog implements Syncable {
// Only count 1 row as an unflushed entry.
this.unflushedEntries.incrementAndGet();
}
+ writeTime += System.currentTimeMillis() - start;
+ writeOps++;
+
// sync txn to file system
+ start = System.currentTimeMillis();
this.sync(info.isMetaRegion());
+ gsyncTime += System.currentTimeMillis() - start;
+ gsyncOps++;
+
}
/**
@@ -1067,8 +1089,6 @@ public class HLog implements Syncable {
long now = System.currentTimeMillis();
this.writer.append(new HLog.Entry(logKey, logEdit));
long took = System.currentTimeMillis() - now;
- writeTime += took;
- writeOps++;
long len = 0;
for(KeyValue kv : logEdit.getKeyValues()) {
len += kv.getLength();
@@ -1146,13 +1166,6 @@ public class HLog implements Syncable {
HLogKey key = makeKey(regionName, tableName, logSeqId,
System.currentTimeMillis());
this.writer.append(new Entry(key, edit));
- writeTime += System.currentTimeMillis() - now;
- writeOps++;
- long len = 0;
- for(KeyValue kv : edit.getKeyValues()) {
- len += kv.getLength();
- }
- writeSize += len;
this.numEntries.incrementAndGet();
Long seq = this.lastSeqWritten.get(regionName);
if (seq != null && logSeqId >= seq.longValue()) {