Updated Branches: refs/heads/apache-blur-0.2 cdd238cea -> c49c21a86
Changing the top command in the shell to show GC times instead of disabled index memory size. Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/528d1fb6 Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/528d1fb6 Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/528d1fb6 Branch: refs/heads/apache-blur-0.2 Commit: 528d1fb639ad59d42f01cd20e9ba4268f5c763bc Parents: cdd238c Author: Aaron McCurry <[email protected]> Authored: Mon Nov 25 21:26:56 2013 -0500 Committer: Aaron McCurry <[email protected]> Committed: Mon Nov 25 21:26:56 2013 -0500 ---------------------------------------------------------------------- .../src/main/java/org/apache/blur/utils/GCWatcherJdk6.java | 9 +++++++++ .../src/main/java/org/apache/blur/utils/GCWatcherJdk7.java | 1 - .../src/main/resources/org/apache/blur/shell/top.properties | 8 ++++---- 3 files changed, 13 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/528d1fb6/blur-core/src/main/java/org/apache/blur/utils/GCWatcherJdk6.java ---------------------------------------------------------------------- diff --git a/blur-core/src/main/java/org/apache/blur/utils/GCWatcherJdk6.java b/blur-core/src/main/java/org/apache/blur/utils/GCWatcherJdk6.java index 6f374c6..03bf6bb 100644 --- a/blur-core/src/main/java/org/apache/blur/utils/GCWatcherJdk6.java +++ b/blur-core/src/main/java/org/apache/blur/utils/GCWatcherJdk6.java @@ -16,6 +16,8 @@ package org.apache.blur.utils; * See the License for the specific language governing permissions and * limitations under the License. */ +import static org.apache.blur.metrics.MetricsConstants.*; + import java.lang.management.GarbageCollectorMXBean; import java.lang.management.ManagementFactory; import java.lang.management.MemoryMXBean; @@ -32,6 +34,9 @@ import java.util.concurrent.TimeUnit; import org.apache.blur.log.Log; import org.apache.blur.log.LogFactory; +import com.yammer.metrics.Metrics; +import com.yammer.metrics.core.MetricName; + public class GCWatcherJdk6 extends TimerTask { private static final Log LOG = LogFactory.getLog(GCWatcherJdk6.class); @@ -49,6 +54,7 @@ public class GCWatcherJdk6 extends TimerTask { private final List<GCAction> _actions = new ArrayList<GCAction>(); private final MemoryMXBean _memoryMXBean; private static GCWatcherJdk6 _instance; + private final com.yammer.metrics.core.Timer _gcTimes; private GCWatcherJdk6(double ratio) { _memoryMXBean = ManagementFactory.getMemoryMXBean(); @@ -76,6 +82,8 @@ public class GCWatcherJdk6 extends TimerTask { _timer = null; LOG.warn("GCWatcherJdk6 was NOT setup."); } + MetricName gcTimesName = new MetricName(ORG_APACHE_BLUR, JVM, GC_TIMES); + _gcTimes = Metrics.newTimer(gcTimesName, TimeUnit.MILLISECONDS, TimeUnit.SECONDS); } public static void registerAction(GCAction action) { @@ -122,6 +130,7 @@ public class GCWatcherJdk6 extends TimerTask { long usedAfter = after.getUsed(); long totalTime = endTime - startTime; + _gcTimes.update(totalTime, TimeUnit.MILLISECONDS); LOG.info("totalTime spent in GC [{0} ms] collected [{1} bytes]", totalTime, (usedBefore - usedAfter)); MemoryUsage heapMemoryUsage = _memoryMXBean.getHeapMemoryUsage(); long max = heapMemoryUsage.getMax(); http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/528d1fb6/blur-core/src/main/java/org/apache/blur/utils/GCWatcherJdk7.java ---------------------------------------------------------------------- diff --git a/blur-core/src/main/java/org/apache/blur/utils/GCWatcherJdk7.java b/blur-core/src/main/java/org/apache/blur/utils/GCWatcherJdk7.java index f66cde8..5164167 100644 --- a/blur-core/src/main/java/org/apache/blur/utils/GCWatcherJdk7.java +++ b/blur-core/src/main/java/org/apache/blur/utils/GCWatcherJdk7.java @@ -77,7 +77,6 @@ public class GCWatcherJdk7 { long totalTime = endTime - startTime; long totalSize = usedBefore - usedAfter; if (totalTime >= _1_SECOND) { - LOG.info("GC event totalTime spent in GC [{0} ms] collected [{1} bytes]", totalTime, totalSize); } _gcTimes.update(totalTime, TimeUnit.MILLISECONDS); http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/528d1fb6/blur-shell/src/main/resources/org/apache/blur/shell/top.properties ---------------------------------------------------------------------- diff --git a/blur-shell/src/main/resources/org/apache/blur/shell/top.properties b/blur-shell/src/main/resources/org/apache/blur/shell/top.properties index 4da0d8a..3fba05d 100644 --- a/blur-shell/src/main/resources/org/apache/blur/shell/top.properties +++ b/blur-shell/src/main/resources/org/apache/blur/shell/top.properties @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -top.columns=SHARD_SERVER,CP,SL,HU,IM,EQ,IQ,RO,RE,WO,WE,CH,CM,CE,CS,TC,IC,SC +top.columns=SHARD_SERVER,CP,SL,HU,GC,EQ,IQ,RO,RE,WO,WE,CH,CM,CE,CS,TC,IC,SC top.sizes=IM,SL top.SHARD_SERVER.shortname=Shard Server @@ -22,7 +22,7 @@ top.IC.shortname=idx cnt top.TC.shortname=tble cnt top.RE.shortname=rd rec top.WE.shortname=wr rec -top.IM.shortname=idx mem +top.GC.shortname=gc time top.RO.shortname=rd row top.WO.shortname=wr row top.CS.shortname=bc size @@ -46,7 +46,7 @@ top.RE.longname="org.apache.blur":type="Blur",name="Read Records/s" top.WE.longname="org.apache.blur":type="Blur",name="Write Records/s" top.RO.longname="org.apache.blur":type="Blur",name="Read Row/s" top.WO.longname="org.apache.blur":type="Blur",name="Write Row/s" -top.IM.longname="org.apache.blur":type="Blur",scope="default",name="Index Memory Usage" +top.GC.longname="org.apache.blur":type="JVM",name="GC Times (ms)" top.TC.longname="org.apache.blur":type="Blur",scope="default",name="Table Count" top.IC.longname="org.apache.blur":type="Blur",scope="default",name="Index Count" top.SC.longname="org.apache.blur":type="Blur",scope="default",name="Segment Count" @@ -65,7 +65,7 @@ top.RE.help=Read Records/s - The number of records read per second (One Minute A top.RO.help=Read Row/s - The number of rows read per second (One Minute Average) top.WE.help=Write Records/s - The number of records write per second (One Minute Average) top.WO.help=Write Row/s - The number of rows write per second (One Minute Average) -top.IM.help=Index Memory Usage - The index heap usage +top.GC.help=GC Times (ms) - (One Minute Average) top.TC.help=Table Count - The number of tables top.IC.help=Index Count - The number of indexes top.SC.help=Segment Count - The number of index segments
