(注:このブログはもう更新していません)この日記は私的なものであり所属会社の見解とは無関係です。 GitHub: takahashikzn

[クラウド帳票エンジンDocurain]

serverVMはclientVMの夢を見るか

昨日、JDK1.6.0_25に更新しました。


"-XX:+TieredCompilation"が使えるようになったということで、
早速Tomcatの起動オプションに追加してみたのですが。

コレがまた、Webアプリのリロードを繰り返すと頻繁にVMエラーで落ちるという。

# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (malloc) failed to allocate 131080 bytes for Chunk::new
# Possible reasons:
#   The system is out of physical RAM or swap space
#   In 32 bit mode, the process size limit was hit
# Possible solutions:
#   Reduce memory load on the system
#   Increase physical memory or swap space
#   Check if swap backing store is full
#   Use 64 bit Java on a 64 bit OS
#   Decrease Java heap size (-Xmx/-Xms)
#   Decrease number of Java threads
#   Decrease Java thread stack sizes (-Xss)
#   Set larger code cache with -XX:ReservedCodeCacheSize=
# This output file may be truncated or incomplete.
#
#  Out of Memory Error (allocation.cpp:317), pid=7768, tid=6436
#
# JRE version: 6.0_25-b06
# Java VM: Java HotSpot(TM) Server VM (20.0-b11 mixed mode windows-x86 )


他に変なオプションを付けたりしているわけではないです。
開発中のアプリということで、リロードを多用するためにMaxPermSizeを多めに取っているくらい。

-Xms512M
-Xmx1024M
-XX:MaxPermSize=384M
-server
-ea
-Dfile.encoding=UTF-8
-XX:+TieredCompilation  ←NEW!!

ちなみに

TieredCompilationとは、serverVMのネックであった起動時間をclientVM並に短縮するオプション。
リリースノート(http://www.oracle.com/technetwork/java/javase/6u25releasenotes-356444.html)によると、

A new feature in this version of HotSpot is "tiered" compilation in the Server VM that enables it to start quickly as does the Client VM, while achieving superior peak performance. This feature is enabled by specifying -server and -XX:+TieredCompilation command options.


このバージョンのHotSpotの新機能は、サーバーVMの『階層型』コンパイラです。
これは、クライアントVM並の起動速度と、優れたピークパフォーマンスの両方を達成するテクノロジです。
この機能を有効にするには、"-server"と"-XX:+TieredCompilation"のオプションを指定して下さい。


だそうです。ふーん。


いま関わっている案件の業務アプリの起動時間を測定してみたところ、
55秒から48秒へと改善されました。
多少は体感できる向上ではあるものの、割と頻繁にVMエラーで落ちることを考えると
まだ実用には耐えない、ということになるでしょう。