2011년 11월 25일 금요일

Performance Tuning the JVM for Running Tomcat


First, Mikusa walks us through the key configuration options we need to understand while performance tuning the JVM:

  • -Xms and ?Xmx. Used to define the size of the heap used by the JVM, -Xms sets the initial size of the heap and -Xmx sets the maximum size of the heap. Specific values depend on the application.For Tomcat, it is recommended that ?xms and ?xmx be set to the same value. Referred to as a fully committed heap, this will instruct the JVM to create a heap that is initially at its maximum size and prevent several full garbage collections from occurring as the heap expands to its maximum size. Remember, max heap equals 4 or 5 times the minimum heap.

  • -XX:PermSize and -XX:MaxPermSize. Used to define the size of the permanent generation space,it is also recommended that these be set to the same value. This will instruct the JVM to create the permanent generation so that it is initially at its maximum size and prevent possible full garbage collections from occurring as the permanent generation expands to its maximum size.

  • -Xss. Used to define the size of the stack for each thread in the JVM. The optimum value varies across applications however, in most cases, the default value used by the JVM is too large. Try lowering the value, starting with 128k, saving memory and increasing the number of threads that can be run on a system. Run Tomcat and look for a StackOverFlow exception in the logs. If you see the exception, then gradually increase the value and restart Tomcat. When the exceptions disappear, you have found the minimal value which works for your deployment.

  • -server. Used to select the Java HotSpot Server VM when running 32-bit Windows. This will instruct the VM that it is running in a server environment and the default configurations will be changed accordingly. 32-bit Solaris and 32-bit Linux installations with two or more CPU's and 2GB or more of RAM will enable this option by default. In addition, all 64-bit OS's have this option enabled by default as there is no 64-bit client VM.

댓글 없음:

댓글 쓰기

블록체인 개요 및 오픈소스 동향

블록체인(block chain) 블록체인은 공공 거래장부이며 가상 화폐로 거래할때 발생할때 발생할 수 있는 해킹을 막는 기술. 분산 데이터베이스의 한 형태로, 지속적으로 성장하는 데이터 기록 리스트로서 분산 노드의 운영자에 의한 임의 조작이 불가...