相同的POJO代码使用非常基本的JDK math api,与持久层无关,只是POJO,但迭代可能会持续数百万轮,所以从Websphere到雄猫可能是10:1。代码是这样的。Websphere的运行速度比Tomcat慢多少原因
for(int i=0;i<200000;i++){
logger.info("calculate result 1");
int result_int1 = new Double(param1_double_left/param1_double_right).intValue();
logger.info("calculate result 2");
int result_int2 = new Double(param2_double_left/param2_double_right).intValue();
logger.info("calculate result 3");
int result_int3 = new Double(param3_double_left/param3_double_right).intValue();
logger.info("calculate result 4");
int result_int4 = new Double(param4_double_left/param4_double_right).intValue();
logger.info("calculate result 5");
int result_int5 = new Double(param5_double_left/param5_double_right).intValue();
//... more calculation with java math like above
}
从log4j的日志从Tomcat,这是相当快的,所以时间戳就像
2016-12-05 17:53:31,200 INFO .... <-200
.... another 10 - 20 lines with same timestamp
2016-12-05 17:53:31,201 INFO .... <-201
.... another 10 - 20 lines with same timestamp
2016-12-05 17:53:31,202 INFO .... <-202
.... another 10 - 20 lines with same timestamp
2016-12-05 17:53:31,203 INFO .... <-203
.... another 10 - 20 lines with same timestamp
2016-12-05 17:53:31,204 INFO .... <-204
.... another 10 - 20 lines with same timestamp
从log4j的日志从WebSphere中,时间戳的增加有更多的时间对每个浪涌
2016-12-05 17:55:47,197 INFO .... <-197
.... another 10 - 20 lines with same timestamp
2016-12-05 17:55:47,212 INFO .... <-212
.... another 10 - 20 lines with same timestamp
2016-12-05 17:55:47,239 INFO .... <-239
.... another 10 - 20 lines with same timestamp
2016-12-05 17:55:47,251 INFO .... <-251
.... another 10 - 20 lines with same timestamp
2016-12-05 17:55:47,277 INFO .... <-277
.... another 10 - 20 lines with same timestamp
所以只是想知道什么可能是关于websphere缓慢的因素。 GC?或其他JVM调优?
您使用的是相同的JDK在每种情况下?你如何衡量时间?您是精确测量for循环还是服务器启动时间被拉入? –
@aguibert是相同的JDK(JDK7)。 Tomcat 6 vs Websphere 8.5。我使用log4j,我可以从websphere中看到日志。我已经更新了这个问题,希望能稍微澄清一下情况。谢谢。 – Dreamer