顯示具有 Performance Tuning 標籤的文章。 顯示所有文章
顯示具有 Performance Tuning 標籤的文章。 顯示所有文章

2012年7月14日 星期六

64-bit HotSpot VM的UseCompressedOops

Java 6 Update 18之後的HotSpot VM版本會根據Java heap最大值設定自動決定是否開啟-XX:+UseCompressedOops。Java heap最大值大約在25 GB以下所得的性能最好

2012年7月11日 星期三

BufferedWriter default buffer size

http://developer.classpath.org/doc/java/io/BufferedWriter.html
default buffer size of 8192 chars.


http://developer.classpath.org/doc/java/io/BufferedWriter-source.html
private static final int DEFAULT_BUFFER_SIZE = 8192;

  91:   public BufferedWriter (Writer out)
  92:   {
  93:     this (out, DEFAULT_BUFFER_SIZE);
  94:   }

 104:   public BufferedWriter (Writer out, int size)
 105:   {
 106:     super(out.lock);
 107:     this.out = out;
 108:     this.buffer = new char[size];
 109:     this.count = 0;
 110:   }

http://javasourcecode.org/html/open-source/jdk/jdk-6u23/java/io/BufferedWriter.java.html
private static int defaultCharBufferSize = 8192;

    public BufferedWriter(Writer out) {
    this(out, defaultCharBufferSize);
    }

    public BufferedWriter(Writer out, int sz) {
    super(out);
    if (sz <= 0)
        throw new IllegalArgumentException("Buffer size <= 0");
    this.out = out;
    cb = new char[sz];
    nChars = sz;
    nextChar = 0;

    lineSeparator = (String) java.security.AccessController.doPrivileged(
               new sun.security.action.GetPropertyAction("line.separator"));
    }




Tuning Java I/O Performance

http://java.sun.com/developer/technicalArticles/Programming/PerfTuning/


For a 1 MB input file, the execution times in seconds of the programs are:
 intro1    6.9
 intro2    0.9
 intro3    0.4

Buffering

Approaches 2 and 3 use the technique of buffering, where large chunks of a file are read from disk, and then accessed a byte or character at a time. Buffering is a basic and important technique for speeding I/O, and several Java classes support buffering (BufferedInputStream for bytes, BufferedReader for characters).



int len = (int)(new File(args[0]).length());byte buf[] = new byte[len];
This approach is convenient, in that a file can be treated as an array of 
bytes. But there's an obvious problem of possibly not having enough memory to 
read in a very large file. 

2012年7月4日 星期三

top 10 most active and update tables in db2 udb database

http://database.ittoolbox.com/groups/technical-functional/db2-l/how-to-grep-top-10-most-active-and-update-tables-in-db2-udb-database-4100480


select substr(abc.tabname,1,40) as TABNAME,abc.rows_written as rowswritten
from SYSIBMADM.snaptab abc
order by abc.rows_written desc fetch first 10 rows only; 

2012年6月30日 星期六

Frequently Asked Questions About the Java HotSpot VM

http://www.oracle.com/technetwork/java/hotspotfaq-138619.html#gc_oom

32-Bit VS 64-Bit JVM


How To Choose 32-Bit or 64-Bit JVM
http://www.techpaste.com/2012/02/choose-32-bit-64-bit-jvm/

Default JVM settings GC, JIT and Java Heap Sizes -Xms & -Xmx on different operating systems
http://www.techpaste.com/2012/02/default-jvm-settings-gc-jit-java-heap-sizes-xms-xmx-operating-systems/

Is a JVM's Maximum Heap Size really 1.7 GB?
http://pauldone.blogspot.tw/2008/08/is-jvms-maximum-heap-size-really-17-gb.html

REF:
java - Benefits/drawbacks to running 64-bit JVM on 64-bit Linux server? - Stack Overflow
http://stackoverflow.com/questions/559433/benefits-drawbacks-to-running-64-bit-jvm-on-64-bit-linux-server

WAS 7之後支援compressed reference

http://www.ibm.com/developerworks/cn/websphere/library/techarticles/0809_alcott/0809_alcott.html

WebSphere Application Server V7 中的新特性

IBM 的 Java SE 6 中的另一个改进是在 64 位 WebSphere Application Server JVM 中使用
压缩引用 (compressed reference)(或指针压缩)。与以前的 32 位 JVM 相比,使用压缩引用可以非常显著地减少 64 位 JVM 的进程内存占用空间。在 IBM 推出 Java SE 6 实现以前,64 位堆的大小为等效的 32 位堆的 1.7 至 2 倍的情况并不鲜见。


IBM JVM:
 -Xcompressedrefs

Oracle JVM:
-XX:+UseCompressedOops

Use -Xcompressedrefs in any of these situations:

  • When your Java applications does not need more than a 25 GB Java heap.
  • When your application uses a lot of native memory and needs the JVM to run in a small footprint.

REF:
http://publib.boulder.ibm.com/infocenter/javasdk/v6r0/index.jsp?topic=%2Fcom.ibm.java.doc.diagnostics.60%2Fdiag%2Funderstanding%2Fmm_compressed_references.html

http://www.slideserve.com/adamdaniel/improving-64-bit-java-performance-using-compressed-references

2012年4月13日 星期五

Jmap -dump

C:\Users\Java>Jmap -dump:format=b,file=f1.dat 5364
Dumping heap to C:\Users\Rex\f1.txt ...
Heap dump file created

-----
5364是pid
可以用jps查到
用jhat去分析
或用eclipse mat去分析

2012年2月10日 星期五

Maximum possible heap size and maximum recommended heap size (32-bit Java)

http://publib.boulder.ibm.com/infocenter/javasdk/tools/index.jsp?topic=%2Fcom.ibm.java.doc.igaa%2F_1vg00014884d287-11c3fb28dae-7ff6_1001.html

Platform Additional options Maximum heap size Recommended heap size limit Additional notes
AIX None 3.25 GB 2.5 GB Maximum heap size is not required to be, but should ideally be, a multiple of 256 MB
Linux None 2 GB 1.5 GB
Hugemem Kernel 3 GB 2.5 GB
Windows None 1.8 GB 1.5 GB
/3GB 1.8 GB 1.8 GB

2012年2月3日 星期五

『起始資料堆大小』(-Xms50m) 和『資料堆大小上限』 (-Xmx256m)

如果WebSphere空白預設是 -Xms50m -Xmx256m (V8)
修改後重啟server1,用ps -ef | grep server1可確認修改結果是否生效
ref:
兩個最重要的 GC 調校參數,分別是起始資料堆大小及資料堆大小上限。起始資料堆大小是指,JVM 啟動時,Java 資料堆一開始可以分配到的記憶體數目。i5/OS 的起始資料堆大小預設為 4 MB,新的 IBM WebSphere Application Server (WAS) 6.1 預設為 50 MB。
資料堆大小上限是指,Java 資料堆可成長到多大。i5/OS 的資料堆大小上限預設為 2 GB,WAS 6.1 預設為 256 MB。以下幾種方法可變更資料堆大小上限:Xmx 參數、GCHMAX,或從 WAS 管理主控台,進入前述起始資料堆大小頁面。

V5R4 隨附的 IBM Technology for Java 實作是 32 位元 Java,最多可處理 4 GB 的記憶體,由於部分要保留給作業系統及 JVM 實作使用,因此資料堆大小上限為 3328 MB (3.25 GB)。應用程式如使用原生程式碼、共享類別快取或記憶體對映檔,可能還需要額外的非 Java 資料堆記憶體,因此 Java 資料堆大小上限會降低。大部分 WAS 應用程式的實際限制約為 2500 MB。

檢查 Java 或 WAS 的效能時,一定要檢查記憶體是否足以提供給 JVM,包括資料堆大小上限所需的記憶體,以及 JVM、Just In Time (JIT) 編譯器及其他原生程式碼所使用的額外記憶體。額外記憶體需求大小不等,可大致估為資料堆大小上限的四分之一。例如,若資料堆大小上限為 1 GB,則記憶體儲存區中至少要預留 1.25 GB 的記憶體。

2012年2月1日 星期三

WebSphere large-page support

http://support.sas.com/documentation/configuration/serverinstallations/websphere/InstallInstructions913ws60.html

Add the -Xlp Java option to the WebSphere generic JVM options. Perform these steps:

  1. In the WebSphere administrative console, select Servers Application servers -> . In this menu sequence, corresponds to the name of the WebSphere server that you are configuring.
  2. Select Java and Process Management -> Process Definition -> Java Virtual Machine.
  3. In the Generic JVM Argument field, add -Xlp. -Xlp enables large-page upport in Java.

2012年1月20日 星期五

(DB2) reorgchk current statistics on table all

db2 => reorgchk current statistics on table all
 基本上是REORG欄位有星號的Table要做reorg

表格統計:

F1: 100 * OVERFLOW / CARD < 5
F2: 100 *(資料頁的有效空間使用率)> 70
F3: 100 *(必要的頁數 / 總頁數)> 80

SCHEMA.NAME                     CARD     OV     NP     FP ACTBLK    TSIZE  F1  F2  F3 REORG
----------------------------------------------------------------------------------------
表格: DB2INST1.EXPLAIN_ARGUMENT
                                   -      -      -      -      -        -   -   -   - ---
表格: DB2INST1.EXPLAIN_DIAGNOSTIC
                                   -      -      -      -      -        -   -   -   - ---
表格: DB2INST1.EXPLAIN_DIAGNOSTIC_DATA
                                   -      -      -      -      -        -   -   -   - ---