在前一篇文章xms/xmx/xss在kette中的调优设置中,我对kettle进行了一次优化,这次我们再一次进行优化,这次效果非常明显,这次优化有两部分:一、修改jvm添加xmn,二、修改日志输出级别
在Java TM Performance一书中,有这样一段话:
-Xmn is convenient to size both the initial and maximum size of the young generation space. It is important to note that if-Xms and -Xmx are not set to the same value and -Xmn is used, a growth or contraction in the Java heap size will not adjust the size of the young generation space. The size of the young generation space will remain constant with any growth or contraction of the Java heap size. Therefore, -Xmn should be used only when -Xms and -Xmx are set to the same value.
好了,看看我的修改结果
# ****************************************************************** # ** Set java runtime options ** # ** Change 512m to higher values in case you run out of memory ** # ** or set the PENTAHO_DI_JAVA_OPTIONS environment variable ** # ** (JAVAMAXMEM is there for compatibility reasons) ** # ****************************************************************** if [ -z "$JAVAMAXMEM" ]; then JAVAMAXMEM="16384" fi if [ -z "$PENTAHO_DI_JAVA_OPTIONS" ]; then PENTAHO_DI_JAVA_OPTIONS="-Xms${JAVAMAXMEM}m -Xmx${JAVAMAXMEM}m -Xmn6144m -Xss1024m" fi
xmx为物理内存的1/4,xmn为xmx为3/8
在用kitchen.sh调用*.job文件时,在调用命令后面添加
-level:Error
在默认的情况下,kettle输出的是基本日志,如果访问十几万的数据库,那基本日志的输出也会达到5、6百兆,这样严重影响了执行效率,所以修改kettle的日志级别为error级,只输出错误日志即可。
以上优化完成后,遍历十几万数据库进行数据统计,只需要2小时55分钟,爽啊,快吧,如果硬件足够好,那还可以再提高不少呢!
时间: 2024-10-13 22:22:44