Saturday 18 January 2014

JMX Remote connection & VisualVM

JMX - Java Management Extensions

Enable remote access in tomcat. Include following options with JAVA_OPTS environment variables in tomcat start-up script.
  • -Dcom.sun.management.jmxremote 
  • -Dcom.sun.management.jmxremote.port=8999 
  • -Dcom.sun.management.jmxremote.authenticate=false 
  • -Dcom.sun.management.jmxremote.ssl=false 
  • -Dcom.sun.management.jmxremote.password.file=pw file path  
  • -Dcom.sun.management.jmxremote.access.file=access file path 
  • -Djava.rmi.server.hostname=(Optional)
You can place the password and permissions files in any location, such as "$CATALINA_HOME/conf/". Make sure to modify the permissions of these files so that they can only be viewed by users with appropriate access :
  • $ chmod 600 /path/to/pw/file
  • $ chmod 600 /path/to/access/file
Include in start-up scipt start_admin.sh

export CATALINA_OPTS="-XX:MaxPermSize=512m -Xms1024M -Xmx2048M -XX:NewRatio=3 -XX:MaxNewSize=700M -XX:-UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSParallelRemarkEnabled -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8999 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=true -Dcom.sun.management.jmxremote.password.file=$TOMCAT_HOME/conf/jmxremote.password -Dcom.sun.management.jmxremote.access.file=$TOMCAT_HOME/conf/jmxremote.access -Djava.rmi.server.hostname=$TOMCAT_HOST"



Process arguments



test@[49]/log% pargs -a 2288
2288:   /usr/java1.6/bin/java -Djava.util.logging.config.file=/opt/ITREfdsc/tomcat/conf
argv[0]: /usr/java1.6/bin/java
argv[1]: -Djava.util.logging.config.file=/opt/ITREfdsc/tomcat/conf/logging.properties
argv[2]: -DthisProcess=CEPServer
argv[3]: -Djava.awt.headless=true
argv[4]: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
argv[5]: -XX:MaxPermSize=512m
argv[6]: -Xms1024M
argv[7]: -Xmx2048M
argv[8]: -XX:NewRatio=3
argv[9]: -XX:MaxNewSize=700M
argv[10]: -XX:-UseConcMarkSweepGC
argv[11]: -XX:+UseParNewGC
argv[12]: -XX:+CMSParallelRemarkEnabled
argv[13]: -Dcom.sun.management.jmxremote
argv[14]: -Dcom.sun.management.jmxremote.port=8999
argv[15]: -Dcom.sun.management.jmxremote.ssl=false
argv[16]: -Dcom.sun.management.jmxremote.authenticate=true
argv[17]: -Dcom.sun.management.jmxremote.password.file=/opt/ITREfdsc/tomcat/conf/jmxremote.password
argv[18]: -Dcom.sun.management.jmxremote.access.file=/opt/ITREfdsc/tomcat/conf/jmxremote.access
argv[19]: -Djava.rmi.server.hostname=ceb-zone
argv[20]: -Djava.endorsed.dirs=/opt/ITREfdsc/tomcat/endorsed
argv[21]: -classpath
argv[22]: /opt/ITREfdsc/tomcat/bin/bootstrap.jar
argv[23]: -Dcatalina.base=/opt/ITREfdsc/tomcat
argv[24]: -Dcatalina.home=/opt/ITREfdsc/tomcat
argv[25]: -Djava.io.tmpdir=/opt/ITREfdsc/tomcat/temp
argv[26]: org.apache.catalina.startup.Bootstrap
argv[27]: start
fdsc@ceb-zone[50]/opt/ITREfdsc/log%


Java SE 6 HotSpot[tm] Virtual Machine Garbage Collection Tuning

Java HotSpot VM Options

--------------------------------------------------------------------------------------------------------------------------
-Djava.awt.headless=true
To use any AWT libraries in your server code on a machine that's not running a windowing interface
CATALINA_OPTS is immensely useful for setting debug parameters, Java memory settings, etc. One very common use is to set the system property java.awt.headless to true. Most graphical applications (like Jasper, JFreechart, LiquidOffice, StyleReport, etc.) will halt Tomcat when they render if something isn't done to disable display rendering, and this is by far the easiest method. (This problem occurs with most J2EE servers, not just Tomcat). Here's how to make this setting in UNIX.
--------------------------------------------------------------------------------------------------------------------------
-Djava.util.logging.config.file=/opt/ITREfdsc/tomcat/conf/logging.properties
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
To provide customised log file config. It is default behaviour of Tomcat and included in catalina.sh
--------------------------------------------------------------------------------------------------------------------------
-XX:MaxPermSize=512m
The permanent space is where are stored the class, methods, internalized strings, and similar objects used by the VM and never deallocated.
-XX:PermSize specifies the initial size that will be allocated during startup of the JVM. If necessary, the JVM will allocate up to -XX:MaxPermSize.
For most applications the permanent generation is not relevant to GC performance. However, some applications dynamically generate and load many classes. For instance, some implementations of JSPs do this. If necessary, the maximum permanent generation size can be increased with MaxPermSize.
--------------------------------------------------------------------------------------------------------------------------
-Xms1024M
-Xmx2048M
-Xms defines the initial size of the heap and -Xmx defines the maximum size of the heap.

--------------------------------------------------------------------------------------------------------------------------
 -XX:NewRatio=3
By default, the young generation size is controlled by NewRatio. For example, setting -XX:NewRatio=3 means that the ratio between the young and tenured generation is 1:3. In other words, the combined size of the eden and survivor spaces will be one fourth of the total heap size.
--------------------------------------------------------------------------------------------------------------------------

-XX:MaxNewSize=700M
-XX:NewSize

--------------------------------------------------------------------------------------------------------------------------

Run Visualvm


Create remote connection


View remote process details

References:

Wednesday 15 January 2014

Setup GXT 3 examples in Eclipse


TODO : Update step by step guide
Reference:
http://www.gwtproject.org/
http://www.sencha.com/examples/
http://eclectide.com/blog/2013/10/11/compiling-sencha-gxt-showcase/
http://www.sencha.com/forum/showthread.php?248378-GWT-2.5-support