相同的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