【JAVA】JAVA应用程序以及JVM性能调优实例

项目背景,数据库A表分库,分库字段为AID

第一、通过visualvm监控对CPU进行远程抽样,可以得到你所监控的package下各个方法的执行时间,从而进行针对性的调优

首先要通过JVM参数来打开JVM的远程连接

JAVA_DEBUG_OPTS=" -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n -Dcom.sun.management.jmxremote.port=9999 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false "

9999是JVM远程连接

8000是远程DEBUG的端口

【JAVA】JAVA应用程序以及JVM性能调优实例_第1张图片

【JAVA】JAVA应用程序以及JVM性能调优实例_第2张图片

【JAVA】JAVA应用程序以及JVM性能调优实例_第3张图片

【JAVA】JAVA应用程序以及JVM性能调优实例_第4张图片

以上可以进行抽样,右边可以设置你想抽样的package

【JAVA】JAVA应用程序以及JVM性能调优实例_第5张图片

同时监视器tab,可以观察CPU,堆内存等情况,主要看堆内存,可以观察YGC的频率。

在我的真实案例中发现抽样的时间最长在A表查询上,结果通过mysql的慢查询日志发现,对A表的查询,并没有用分库字段AID,所以很慢,最后对dao进行改进,通过分库字段AID进行查询,从而提高了效率。

第二、可以通过btrace对方法执行时间进行监控,更加详细

package btrace.btrace;

import com.sun.btrace.annotations.BTrace;
import com.sun.btrace.annotations.Kind;
import com.sun.btrace.annotations.Location;
import com.sun.btrace.annotations.OnMethod;
import com.sun.btrace.annotations.ProbeClassName;
import com.sun.btrace.annotations.ProbeMethodName;
import com.sun.btrace.annotations.TLS;
import static com.sun.btrace.BTraceUtils.*;

/**
 * Hello world!
 *
 */
@BTrace
public class App {
	@TLS
	private static long startTime = 0;

	@OnMethod(clazz = "org.springframework.orm.ibatis.SqlMapClientTemplate", method = "queryForList")
	public static void startMethod() {
		startTime = timeMillis();
	}

	@OnMethod(clazz = "org.springframework.orm.ibatis.SqlMapClientTemplate", method = "queryForList", location = @Location(value = Kind.RETURN))
	public static void endMethod(@ProbeClassName String className,
			@ProbeMethodName String methodName) {
		// println(concat("threadId:", str(threadId(currentThread()))));
		// println(strcat("className:", className));
		// println(strcat("methodName:", methodName));
		println(strcat("exeTime:", str(timeMillis() - startTime)));

	}

}
以上方法就是监控数据库查询的执行时间

具体btrace的用法,参见http://blog.csdn.net/chiweitree/article/details/40297797

第三、JVM调优

首先jps查询出需要监控的进程ID信息

jstat -gcutil -h5 PID 1s

通过以上命令可观察程序运行期间,堆内存的GC情况

  S0     S1     E      O      P     YGC     YGCT    FGC    FGCT     GCT   
 42.68   0.00  61.99   0.00  10.41      2    0.184     2    0.139    0.323
 42.68   0.00  69.99   0.00  10.43      2    0.184     2    0.139    0.323
 42.68   0.00  86.55   0.00  10.46      2    0.184     2    0.139    0.323
 42.68   0.00  97.93   0.00  10.46      2    0.184     2    0.139    0.323
  0.00  37.35  26.39   0.00  10.48      3    0.224     2    0.139    0.363
  S0     S1     E      O      P     YGC     YGCT    FGC    FGCT     GCT   
  0.00  37.35  49.21   0.00  10.54      3    0.224     2    0.139    0.363
  0.00  37.35  73.53   0.00  10.56      3    0.224     2    0.139    0.363
  0.00  37.35  93.66   0.00  10.56      3    0.224     2    0.139    0.363
 38.79   0.00  30.68   0.00  10.56      4    0.258     2    0.139    0.397
 38.79   0.00  57.51   0.00  10.56      4    0.258     2    0.139    0.397
JVM参数

JAVA_OPTS=" -server -Xms4g -Xmx4g -Xmn2g -Xss256K -XX:PermSize=512M -XX:MaxPermSize=512M -XX:SurvivorRatio=8 -XX:CMSInitiatingOccupancyFraction=70 -XX:+PrintCommandLineFlags -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+UseCMSCompactAtFullCollection -XX:+UseCMSInitiatingOccupancyOnly -XX:+CMSClassUnloadingEnabled -XX:+CMSParallelRemarkEnabled -XX:+ExplicitGCInvokesConcurrent -XX:+UseCompressedOops -XX:+UseFastAccessorMethods -XX:+HeapDumpOnOutOfMemoryError-verbose:gc -XX:+PrintGCDateStamps -XX:+PrintGCDetails -Xloggc:/home/gc.log"

可以再gc.log中看到程序GC的打印日志

2015-07-28T15:13:34.020+0800: 316.108: [GC2015-07-28T15:13:34.020+0800: 316.108: [ParNew: 1767302K->78313K(1887488K), 0.0401590 secs] 1767302K->78313K(3984640K), 0.0405870 secs] [Times: user=0.75 sys=0.06, real=0.04 secs]
2015-07-28T15:13:42.392+0800: 324.480: [GC2015-07-28T15:13:42.392+0800: 324.480: [ParNew: 1756137K->81323K(1887488K), 0.0338710 secs] 1756137K->81323K(3984640K), 0.0342750 secs] [Times: user=0.72 sys=0.02, real=0.03 secs]
2015-07-28T15:13:50.276+0800: 332.364: [GC2015-07-28T15:13:50.276+0800: 332.364: [ParNew: 1759147K->86990K(1887488K), 0.0393170 secs] 1759147K->86990K(3984640K), 0.0397140 secs] [Times: user=0.75 sys=0.01, real=0.04 secs]
2015-07-28T15:13:55.236+0800: 337.324: [GC2015-07-28T15:13:55.237+0800: 337.324: [ParNew: 1764814K->84886K(1887488K), 0.0363840 secs] 1764814K->84886K(3984640K), 0.0367710 secs] [Times: user=0.76 sys=0.00, real=0.04 secs]
2015-07-28T15:13:59.492+0800: 341.580: [GC2015-07-28T15:13:59.493+0800: 341.580: [ParNew: 1762710K->90339K(1887488K), 0.0351400 secs] 1762710K->90339K(3984640K), 0.0355300 secs] [Times: user=0.73 sys=0.01, real=0.03 secs]
2015-07-28T15:14:03.405+0800: 345.492: [GC2015-07-28T15:14:03.405+0800: 345.492: [ParNew: 1768163K->91478K(1887488K), 0.0392400 secs] 1768163K->91478K(3984640K), 0.0396900 secs] [Times: user=0.75 sys=0.02, real=0.04 secs]
2015-07-28T15:14:07.352+0800: 349.440: [GC2015-07-28T15:14:07.353+0800: 349.440: [ParNew: 1769302K->86699K(1887488K), 0.0393790 secs] 1769302K->86699K(3984640K), 0.0397830 secs] [Times: user=0.76 sys=0.01, real=0.04 secs]
2015-07-28T15:14:11.020+0800: 353.107: [GC2015-07-28T15:14:11.020+0800: 353.107: [ParNew: 1764523K->97148K(1887488K), 0.0352980 secs] 1764523K->97148K(3984640K), 0.0357460 secs] [Times: user=0.76 sys=0.00, real=0.04 secs]
2015-07-28T15:14:14.519+0800: 356.606: [GC2015-07-28T15:14:14.519+0800: 356.607: [ParNew: 1774972K->91869K(1887488K), 0.0393800 secs] 1774972K->91869K(3984640K), 0.0398440 secs] [Times: user=0.77 sys=0.00, real=0.04 secs]
2015-07-28T15:14:17.892+0800: 359.980: [GC2015-07-28T15:14:17.892+0800: 359.980: [ParNew: 1769693K->96431K(1887488K), 0.0389180 secs] 1769693K->96431K(3984640K), 0.0393260 secs] [Times: user=0.76 sys=0.03, real=0.04 secs]
2015-07-28T15:14:20.862+0800: 362.949: [GC2015-07-28T15:14:20.862+0800: 362.950: [ParNew: 1774255K->97621K(1887488K), 0.0347570 secs] 1774255K->97621K(3984640K), 0.0351690 secs] [Times: user=0.76 sys=0.01, real=0.04 secs]
2015-07-28T15:14:24.150+0800: 366.237: [GC2015-07-28T15:14:24.150+0800: 366.237: [ParNew: 1775445K->102082K(1887488K), 0.0395480 secs] 1775445K->102082K(3984640K), 0.0399700 secs] [Times: user=0.74 sys=0.01, real=0.04 secs]
2015-07-28T15:14:27.348+0800: 369.436: [GC2015-07-28T15:14:27.348+0800: 369.436: [ParNew: 1779906K->96851K(1887488K), 0.0402300 secs] 1779906K->96855K(3984640K), 0.0406700 secs] [Times: user=0.78 sys=0.02, real=0.04 secs]
2015-07-28T15:14:30.178+0800: 372.266: [GC2015-07-28T15:14:30.178+0800: 372.266: [ParNew: 1774675K->99460K(1887488K), 0.1000470 secs] 1774679K->104625K(3984640K), 0.1004750 secs] [Times: user=0.90 sys=0.04, real=0.10 secs]
2015-07-28T15:14:33.026+0800: 375.113: [GC2015-07-28T15:14:33.026+0800: 375.113: [ParNew: 1777284K->67576K(1887488K), 0.2484960 secs] 1782449K->126007K(3984640K), 0.2489280 secs] [Times: user=1.19 sys=0.12, real=0.25 secs]
2015-07-28T15:14:35.899+0800: 377.986: [GC2015-07-28T15:14:35.899+0800: 377.986: [ParNew: 1745400K->21681K(1887488K), 0.0329390 secs] 1803831K->85708K(3984640K), 0.0333810 secs] [Times: user=0.45 sys=0.01, real=0.03 secs]
2015-07-28T15:14:38.399+0800: 380.487: [GC2015-07-28T15:14:38.400+0800: 380.487: [ParNew: 1699505K->10848K(1887488K), 0.0205730 secs] 1763532K->75557K(3984640K), 0.0209950 secs] [Times: user=0.30 sys=0.01, real=0.02 secs]
2015-07-28T15:14:41.053+0800: 383.140: [GC2015-07-28T15:14:41.053+0800: 383.141: [ParNew: 1688672K->11212K(1887488K), 0.0218650 secs] 1753381K->76925K(3984640K), 0.0222910 secs] [Times: user=0.32 sys=0.01, real=0.02 secs]
2015-07-28T15:14:43.796+0800: 385.884: [GC2015-07-28T15:14:43.797+0800: 385.884: [ParNew: 1689036K->11128K(1887488K), 0.0259320 secs] 1754749K->77659K(3984640K), 0.0263870 secs] [Times: user=0.28 sys=0.03, real=0.03 secs]
2015-07-28T15:14:46.496+0800: 388.584: [GC2015-07-28T15:14:46.496+0800: 388.584: [ParNew: 1688952K->10060K(1887488K), 0.0261460 secs] 1755483K->77193K(3984640K), 0.0265860 secs] [Times: user=0.29 sys=0.01, real=0.03 secs]
2015-07-28T15:14:49.093+0800: 391.180: [GC2015-07-28T15:14:49.093+0800: 391.180: [ParNew: 1687884K->9787K(1887488K), 0.0232830 secs] 1755017K->77553K(3984640K), 0.0237190 secs] [Times: user=0.28 sys=0.01, real=0.02 secs]
2015-07-28T15:14:51.644+0800: 393.731: [GC2015-07-28T15:14:51.644+0800: 393.731: [ParNew: 1687611K->9175K(1887488K), 0.0198960 secs] 1755377K->77353K(3984640K), 0.0203130 secs] [Times: user=0.29 sys=0.01, real=0.02 secs]
2015-07-28T15:14:54.150+0800: 396.237: [GC2015-07-28T15:14:54.150+0800: 396.237: [ParNew: 1686999K->9137K(1887488K), 0.0257830 secs] 1755177K->77644K(3984640K), 0.0262240 secs] [Times: user=0.29 sys=0.01, real=0.02 secs]
2015-07-28T15:14:56.375+0800: 398.462: [GC2015-07-28T15:14:56.375+0800: 398.463: [ParNew: 1686961K->10076K(1887488K), 0.0249100 secs] 1755468K->78984K(3984640K), 0.0253700 secs] [Times: user=0.28 sys=0.01, real=0.03 secs]
2015-07-28T15:14:58.588+0800: 400.676: [GC2015-07-28T15:14:58.588+0800: 400.676: [ParNew: 1687900K->9059K(1887488K), 0.0205480 secs] 1756808K->78535K(3984640K), 0.0209840 secs] [Times: user=0.28 sys=0.02, real=0.03 secs]
2015-07-28T15:15:00.954+0800: 403.041: [GC2015-07-28T15:15:00.954+0800: 403.041: [ParNew: 1686883K->8772K(1887488K), 0.0241280 secs] 1756359K->78652K(3984640K), 0.0245870 secs] [Times: user=0.28 sys=0.02, real=0.02 secs]
2015-07-28T15:15:03.451+0800: 405.538: [GC2015-07-28T15:15:03.451+0800: 405.539: [ParNew: 1686596K->8335K(1887488K), 0.0281500 secs] 1756476K->78778K(3984640K), 0.0285780 secs] [Times: user=0.37 sys=0.01, real=0.03 secs]
2015-07-28T15:15:06.042+0800: 408.130: [GC2015-07-28T15:15:06.043+0800: 408.130: [ParNew: 1686159K->7215K(1887488K), 0.0251280 secs] 1756602K->78068K(3984640K), 0.0255670 secs] [Times: user=0.29 sys=0.01, real=0.02 secs]
2015-07-28T15:15:08.558+0800: 410.646: [GC2015-07-28T15:15:08.559+0800: 410.646: [ParNew: 1685039K->6995K(1887488K), 0.0237540 secs] 1755892K->77917K(3984640K), 0.0241750 secs] [Times: user=0.26 sys=0.00, real=0.03 secs]
2015-07-28T15:15:10.963+0800: 413.051: [GC2015-07-28T15:15:10.963+0800: 413.051: [ParNew: 1684819K->7039K(1887488K), 0.0193990 secs] 1755741K->78332K(3984640K), 0.0198190 secs] [Times: user=0.28 sys=0.00, real=0.02 secs]
2015-07-28T15:15:13.342+0800: 415.430: [GC2015-07-28T15:15:13.342+0800: 415.430: [ParNew: 1684863K->6811K(1887488K), 0.0194730 secs] 1756156K->78380K(3984640K), 0.0199130 secs] [Times: user=0.26 sys=0.02, real=0.02 secs]
2015-07-28T15:15:15.544+0800: 417.631: [GC2015-07-28T15:15:15.544+0800: 417.632: [ParNew: 1684635K->4878K(1887488K), 0.0247980 secs] 1756204K->76967K(3984640K), 0.0252120 secs] [Times: user=0.29 sys=0.01, real=0.02 secs]
2015-07-28T15:15:18.163+0800: 420.251: [GC2015-07-28T15:15:18.163+0800: 420.251: [ParNew: 1682702K->5242K(1887488K), 0.0265430 secs] 1754791K->77617K(3984640K), 0.0269780 secs] [Times: user=0.26 sys=0.02, real=0.02 secs]
2015-07-28T15:15:20.385+0800: 422.472: [GC2015-07-28T15:15:20.385+0800: 422.473: [ParNew: 1683066K->4927K(1887488K), 0.0222080 secs] 1755441K->77610K(3984640K), 0.0226550 secs] [Times: user=0.32 sys=0.00, real=0.02 secs]
2015-07-28T15:15:22.691+0800: 424.779: [GC2015-07-28T15:15:22.692+0800: 424.779: [ParNew: 1682751K->4937K(1887488K), 0.0193930 secs] 1755434K->77914K(3984640K), 0.0198200 secs] [Times: user=0.27 sys=0.01, real=0.02 secs]
2015-07-28T15:15:24.943+0800: 427.031: [GC2015-07-28T15:15:24.943+0800: 427.031: [ParNew: 1682761K->4382K(1887488K), 0.0233020 secs] 1755738K->77640K(3984640K), 0.0237210 secs] [Times: user=0.27 sys=0.01, real=0.02 secs]
2015-07-28T15:15:27.242+0800: 429.329: [GC2015-07-28T15:15:27.242+0800: 429.329: [ParNew: 1682206K->4372K(1887488K), 0.0160300 secs] 1755464K->77723K(3984640K), 0.0164580 secs] [Times: user=0.24 sys=0.01, real=0.02 secs]
2015-07-28T15:15:29.435+0800: 431.522: [GC2015-07-28T15:15:29.435+0800: 431.522: [ParNew: 1682196K->3603K(1887488K), 0.0219050 secs] 1755547K->77508K(3984640K), 0.0223460 secs] [Times: user=0.26 sys=0.02, real=0.02 secs]
2015-07-28T15:15:31.657+0800: 433.744: [GC2015-07-28T15:15:31.657+0800: 433.744: [ParNew: 1681427K->3012K(1887488K), 0.0219840 secs] 1755332K->77129K(3984640K), 0.0224730 secs] [Times: user=0.23 sys=0.02, real=0.02 secs]
2015-07-28T15:15:33.848+0800: 435.936: [GC2015-07-28T15:15:33.848+0800: 435.936: [ParNew: 1680836K->2912K(1887488K), 0.0217890 secs] 1754953K->77201K(3984640K), 0.0222080 secs] [Times: user=0.22 sys=0.02, real=0.02 secs]
2015-07-28T15:15:36.035+0800: 438.123: [GC2015-07-28T15:15:36.035+0800: 438.123: [ParNew: 1680736K->2775K(1887488K), 0.0209570 secs] 1755025K->77172K(3984640K), 0.0214130 secs] [Times: user=0.24 sys=0.01, real=0.02 secs]
2015-07-28T15:15:38.479+0800: 440.566: [GC2015-07-28T15:15:38.479+0800: 440.566: [ParNew: 1680599K->2592K(1887488K), 0.0196580 secs] 1754996K->77045K(3984640K), 0.0201010 secs] [Times: user=0.22 sys=0.01, real=0.02 secs]
2015-07-28T15:15:40.878+0800: 442.965: [GC2015-07-28T15:15:40.878+0800: 442.965: [ParNew: 1680416K->2359K(1887488K), 0.0220450 secs] 1754869K->76904K(3984640K), 0.0224530 secs] [Times: user=0.24 sys=0.01, real=0.02 secs]
2015-07-28T15:15:43.285+0800: 445.372: [GC2015-07-28T15:15:43.285+0800: 445.373: [ParNew: 1680183K->2491K(1887488K), 0.0219340 secs] 1754728K->77081K(3984640K), 0.0223440 secs] [Times: user=0.24 sys=0.01, real=0.03 secs]
2015-07-28T15:15:45.683+0800: 447.771: [GC2015-07-28T15:15:45.684+0800: 447.771: [ParNew: 1680315K->2484K(1887488K), 0.0188730 secs] 1754905K->77093K(3984640K), 0.0193130 secs] [Times: user=0.23 sys=0.01, real=0.02 secs]
2015-07-28T15:15:48.042+0800: 450.130: [GC2015-07-28T15:15:48.042+0800: 450.130: [ParNew: 1680308K->2680K(1887488K), 0.0177250 secs] 1754917K->77315K(3984640K), 0.0181780 secs] [Times: user=0.24 sys=0.02, real=0.02 secs]
2015-07-28T15:15:50.465+0800: 452.552: [GC2015-07-28T15:15:50.465+0800: 452.552: [ParNew: 1680504K->2604K(1887488K), 0.0175840 secs] 1755139K->77284K(3984640K), 0.0179790 secs] [Times: user=0.25 sys=0.01, real=0.02 secs]
2015-07-28T15:15:52.726+0800: 454.814: [GC2015-07-28T15:15:52.727+0800: 454.814: [ParNew: 1680428K->2507K(1887488K), 0.0210250 secs] 1755108K->77239K(3984640K), 0.0214630 secs] [Times: user=0.22 sys=0.03, real=0.03 secs]
2015-07-28T15:15:55.320+0800: 457.407: [GC2015-07-28T15:15:55.320+0800: 457.407: [ParNew: 1680331K->2486K(1887488K), 0.0204240 secs] 1755063K->77256K(3984640K), 0.0208660 secs] [Times: user=0.24 sys=0.01, real=0.02 secs]
2015-07-28T15:15:57.719+0800: 459.806: [GC2015-07-28T15:15:57.719+0800: 459.806: [ParNew: 1680310K->2449K(1887488K), 0.0210310 secs] 1755080K->77297K(3984640K), 0.0214520 secs] [Times: user=0.23 sys=0.01, real=0.02 secs]
2015-07-28T15:16:00.036+0800: 462.123: [GC2015-07-28T15:16:00.036+0800: 462.123: [ParNew: 1680273K->2268K(1887488K), 0.0210580 secs] 1755121K->77143K(3984640K), 0.0214610 secs] [Times: user=0.24 sys=0.02, real=0.02 secs]
2015-07-28T15:16:02.313+0800: 464.401: [GC2015-07-28T15:16:02.314+0800: 464.401: [ParNew: 1680092K->2578K(1887488K), 0.0227090 secs] 1754967K->77514K(3984640K), 0.0231380 secs] [Times: user=0.25 sys=0.01, real=0.02 secs]
2015-07-28T15:16:04.585+0800: 466.673: [GC2015-07-28T15:16:04.586+0800: 466.673: [ParNew: 1680402K->2414K(1887488K), 0.0188260 secs] 1755338K->77380K(3984640K), 0.0192210 secs] [Times: user=0.24 sys=0.00, real=0.02 secs]
2015-07-28T15:16:06.760+0800: 468.848: [GC2015-07-28T15:16:06.761+0800: 468.848: [ParNew: 1680238K->2576K(1887488K), 0.0226670 secs] 1755204K->77570K(3984640K), 0.0230830 secs] [Times: user=0.25 sys=0.00, real=0.02 secs]
2015-07-28T15:16:08.981+0800: 471.069: [GC2015-07-28T15:16:08.982+0800: 471.069: [ParNew: 1680400K->2327K(1887488K), 0.0273190 secs] 1755394K->77342K(3984640K), 0.0277480 secs] [Times: user=0.26 sys=0.00, real=0.02 secs]
2015-07-28T15:16:11.197+0800: 473.284: [GC2015-07-28T15:16:11.197+0800: 473.284: [ParNew: 1680151K->2422K(1887488K), 0.0172500 secs] 1755166K->77464K(3984640K), 0.0176680 secs] [Times: user=0.23 sys=0.02, real=0.02 secs]
2015-07-28T15:16:13.537+0800: 475.624: [GC2015-07-28T15:16:13.537+0800: 475.624: [ParNew: 1680246K->2441K(1887488K), 0.0217380 secs] 1755288K->77550K(3984640K), 0.0221870 secs] [Times: user=0.24 sys=0.01, real=0.02 secs]
2015-07-28T15:16:15.962+0800: 478.050: [GC2015-07-28T15:16:15.963+0800: 478.050: [ParNew: 1680265K->2428K(1887488K), 0.0207010 secs] 1755374K->77574K(3984640K), 0.0211410 secs] [Times: user=0.25 sys=0.01, real=0.02 secs]
2015-07-28T15:16:18.411+0800: 480.499: [GC2015-07-28T15:16:18.412+0800: 480.499: [ParNew: 1680252K->2428K(1887488K), 0.0177620 secs] 1755398K->77597K(3984640K), 0.0181860 secs] [Times: user=0.25 sys=0.01, real=0.01 secs]
2015-07-28T15:16:20.851+0800: 482.939: [GC2015-07-28T15:16:20.851+0800: 482.939: [ParNew: 1680252K->2561K(1887488K), 0.0170000 secs] 1755421K->77753K(3984640K), 0.0174790 secs] [Times: user=0.22 sys=0.02, real=0.02 secs]
2015-07-28T15:16:23.253+0800: 485.341: [GC2015-07-28T15:16:23.254+0800: 485.341: [ParNew: 1680385K->2650K(1887488K), 0.0213510 secs] 1755577K->77917K(3984640K), 0.0217930 secs] [Times: user=0.30 sys=0.01, real=0.02 secs]
2015-07-28T15:16:25.868+0800: 487.955: [GC2015-07-28T15:16:25.868+0800: 487.955: [ParNew: 1680474K->2540K(1887488K), 0.0180950 secs] 1755741K->77837K(3984640K), 0.0185370 secs] [Times: user=0.23 sys=0.01, real=0.02 secs]
2015-07-28T15:16:28.205+0800: 490.293: [GC2015-07-28T15:16:28.206+0800: 490.293: [ParNew: 1680364K->2470K(1887488K), 0.0167730 secs] 1755661K->77819K(3984640K), 0.0172370 secs] [Times: user=0.21 sys=0.02, real=0.02 secs]
2015-07-28T15:16:30.483+0800: 492.570: [GC2015-07-28T15:16:30.483+0800: 492.570: [ParNew: 1680294K->2543K(1887488K), 0.0201510 secs] 1755643K->77932K(3984640K), 0.0206130 secs] [Times: user=0.25 sys=0.00, real=0.02 secs]
2015-07-28T15:16:32.933+0800: 495.020: [GC2015-07-28T15:16:32.933+0800: 495.021: [ParNew: 1680367K->2287K(1887488K), 0.0218390 secs] 1755756K->77709K(3984640K), 0.0222950 secs] [Times: user=0.26 sys=0.02, real=0.03 secs]
2015-07-28T15:16:35.173+0800: 497.260: [GC2015-07-28T15:16:35.173+0800: 497.260: [ParNew: 1680111K->2497K(1887488K), 0.0218220 secs] 1755533K->77934K(3984640K), 0.0222760 secs] [Times: user=0.25 sys=0.02, real=0.03 secs]
2015-07-28T15:16:37.420+0800: 499.507: [GC2015-07-28T15:16:37.420+0800: 499.507: [ParNew: 1680321K->2570K(1887488K), 0.0180050 secs] 1755758K->78074K(3984640K), 0.0184780 secs] [Times: user=0.23 sys=0.01, real=0.02 secs]
2015-07-28T15:16:39.686+0800: 501.774: [GC2015-07-28T15:16:39.686+0800: 501.774: [ParNew: 1680394K->2725K(1887488K), 0.0213120 secs] 1755898K->78267K(3984640K), 0.0217480 secs] [Times: user=0.25 sys=0.02, real=0.02 secs]
2015-07-28T15:16:41.966+0800: 504.054: [GC2015-07-28T15:16:41.967+0800: 504.054: [ParNew: 1680549K->2787K(1887488K), 0.0201050 secs] 1756091K->78343K(3984640K), 0.0205510 secs] [Times: user=0.25 sys=0.02, real=0.02 secs]
2015-07-28T15:16:44.222+0800: 506.310: [GC2015-07-28T15:16:44.223+0800: 506.310: [ParNew: 1680611K->2422K(1887488K), 0.0213470 secs] 1756167K->78071K(3984640K), 0.0218030 secs] [Times: user=0.24 sys=0.01, real=0.02 secs]
2015-07-28T15:16:46.509+0800: 508.597: [GC2015-07-28T15:16:46.510+0800: 508.597: [ParNew: 1680246K->2495K(1887488K), 0.0207630 secs] 1755895K->78158K(3984640K), 0.0212370 secs] [Times: user=0.25 sys=0.02, real=0.02 secs]
2015-07-28T15:16:48.795+0800: 510.883: [GC2015-07-28T15:16:48.796+0800: 510.883: [ParNew: 1680319K->2881K(1887488K), 0.0189630 secs] 1755982K->78569K(3984640K), 0.0194290 secs] [Times: user=0.21 sys=0.01, real=0.01 secs]
2015-07-28T15:16:50.993+0800: 513.080: [GC2015-07-28T15:16:50.993+0800: 513.080: [ParNew: 1680705K->2666K(1887488K), 0.0207800 secs] 1756393K->78435K(3984640K), 0.0212230 secs] [Times: user=0.23 sys=0.00, real=0.02 secs]
2015-07-28T15:16:53.608+0800: 515.696: [GC2015-07-28T15:16:53.608+0800: 515.696: [ParNew: 1680490K->2644K(1887488K), 0.0158680 secs] 1756259K->78452K(3984640K), 0.0163300 secs] [Times: user=0.25 sys=0.01, real=0.01 secs]
2015-07-28T15:16:56.035+0800: 518.122: [GC2015-07-28T15:16:56.035+0800: 518.123: [ParNew: 1680468K->2368K(1887488K), 0.0175990 secs] 1756276K->78200K(3984640K), 0.0180450 secs] [Times: user=0.24 sys=0.00, real=0.02 secs]
2015-07-28T15:16:58.592+0800: 520.680: [GC2015-07-28T15:16:58.593+0800: 520.680: [ParNew: 1680192K->2332K(1887488K), 0.0165170 secs] 1756024K->78216K(3984640K), 0.0169950 secs] [Times: user=0.25 sys=0.01, real=0.02 secs]
2015-07-28T15:17:01.379+0800: 523.466: [GC2015-07-28T15:17:01.379+0800: 523.466: [ParNew: 1680156K->2109K(1887488K), 0.0166910 secs] 1756040K->78017K(3984640K), 0.0171070 secs] [Times: user=0.21 sys=0.01, real=0.01 secs]
2015-07-28T15:17:04.316+0800: 526.404: [GC2015-07-28T15:17:04.317+0800: 526.404: [ParNew: 1679933K->1833K(1887488K), 0.0222350 secs] 1755841K->77759K(3984640K), 0.0226740 secs] [Times: user=0.21 sys=0.02, real=0.03 secs]
2015-07-28T15:17:08.469+0800: 530.557: [GC2015-07-28T15:17:08.469+0800: 530.557: [ParNew: 1679657K->1763K(1887488K), 0.0201360 secs] 1755583K->77740K(3984640K), 0.0205750 secs] [Times: user=0.21 sys=0.01, real=0.02 secs] 
可以详细的看到GC的执行时间,计算GC的次数,评估GC的频率


附:
【JAVA】JAVA应用程序以及JVM性能调优实例_第6张图片


你可能感兴趣的:(java,jvm)