Help us understand the problem. What is going on with this article?

JVMオプションのJavaコマンド起動スクリプトのひな形

More than 5 years have passed since last update.
java -XX:+PrintFlagsFinal -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions

で状態の確認。

ひな形

バッチ処理のjarを想定。Java7で使用中。Java8では未確認。
-Xmxやら-XmsやらはJVM_TUNEに書く、けど大抵はJVMが自動でよしなに設定してくれるんじゃないかな。

run.sh
function run_batch() {
  local TODAY=$(date +%Y_%m_%d)
  local JVM_LOG_DIR="/var/log/app_batch"

  local JVM_TUNE=""
  local JVM_GC_LOG="-Xloggc:$JVM_LOG_DIR/gc.log.$TODAY \
   -XX:+PrintGCDetails -XX:+PrintGCDateStamps \
   -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=10M"
  local JVM_DUMP="-XX:+HeapDumpOnOutOfMemoryError \
   -XX:HeapDumpPath=$JVM_LOG_DIR/ \
   -XX:ErrorFile=$JVM_LOG_DIR/hs_err_pid%p.log"
  local JVM_OPTS="$JVM_TUNE $JVM_GC_LOG $JVM_DUMP"

  java $JVM_OPTS -jar batch-${VER}.jar
  return 0
}

参考

shrkw
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away