Showing posts with label Java. Show all posts
Showing posts with label Java. Show all posts

Enable JMX access in Alfresco to monitor JVM memory usage through VisualVM or Jconsle

One small post but useful for those who wants to monitor Alfresco's JVM memory usage through VisualVM.

To enable connection through JMX, first you need to enable it in setenv.sh file. Simply add below line and restart Alfresco. You should be able to connect to JMX.

Linux:
export JAVA_OPTS="${JAVA_OPTS} -Dcom.sun.management.jmxremote -Djava.net.preferIPv4Stack=true"

Winodws:
set JAVA_OPTS=%JAVA_OPTS% -Dcom.sun.management.jmxremote -Djava.net.preferIPv4Stack=true

In VisulVM, you can connect using below string. Please select "Add JMX connection".

Alfresco Fetal Error: libdcpr.so+0x1330b Java Crashed

You would have seen java crash error log. This message does not show any information like due to which class or process java crashed. But finally we found that one culprit document we were uploading in Alfresco, which was having "Hindi" characters. So if you come across this kind of error, check your recently uploaded document if it is having language other than English.

Hope this will help!

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007fbcd266430b, pid=8028, tid=140448967481088
#
# JRE version: 6.0_27-b07
# Java VM: Java HotSpot(TM) 64-Bit Server VM (20.2-b06 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C  [libdcpr.so+0x1330b]  signed char+0xbb
#
# An error report file with more information is saved as:
# /opt/alfresco-4.0.1/hs_err_pid8028.log
#
# If you would like to submit a bug report, please visit:
#   http://java.sun.com/webapps/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

Alfresco Performance tuning by setting JVM memory parameters

Since last couple of days I was working on Alfresco's JVM tuning. I faced below issues when it was configured previously.
  • OldGen space was utilized completely
  • Per Survivor Space was too utilized completely
  • Full GC was taking time which leads to stop application responding for time being
My previous JVM settings were as given below:

export JAVA_OPTS="-Xms2048m -Xmx4096m -Xss1024k -XX:MaxPermSize=512m -XX:NewSize=1024m -XX:+UseConcMarkSweepGC -XX:+UseCodeCacheFlushing -XX:ReservedCodeCacheSize=64m -Djava.awt.headless=true -Dalfresco.home=/opt/alfresco4 -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.ssl=false -Dsun.security.ssl.allowUnsafeRenegotiation=true -Djava.net.preferIPv4Stack=true"

After making changes in few parameters, I got below settings which works perfectly fine. I had to increase memory allocation and tune other parameters.

export JAVA_OPTS="-Xms4096m -Xmx8192m -XX:MaxPermSize=512m -XX:NewSize=3072m -XX:+UseConcMarkSweepGC -XX:+UseCodeCacheFlushing -XX:ReservedCodeCacheSize=64m -Djava.awt.headless=true -Dalfresco.home=/opt/alfresco4 -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.ssl=false -Dsun.security.ssl.allowUnsafeRenegotiation=true -Djava.net.preferIPv4Stack=true"

I have taken screenshot from VisualVM.

Heap Memory and CPU Usage:

OldGen and Eden Space usage:


Installing Apache Ant on linux / CentOS / Red Hat

Prerequisites:
- Make sure you have installed JAVA . If not then click here to install java.

Steps:
1. First download Ant binary packages from Apache. You may use below link to download Apache Ant.
http://apache.mirrors.tds.net//ant/binaries/apache-ant-1.9.2-bin.tar.gz

2. Keep downloaded binary file at some location. For example: /opt/apache-ant-1.9.2-bin.tar.gz.
3. Now go to /opt directory and extract zip file using below command.
cd /opt/
tar -zxvf apache-ant-1.9.2-bin.tar.gz
4. When you extract zip file it will create /opt/apache-ant-1.9.2 folder. Now we need to set ANT_HOME variable.
so open /etc/profile file and at the end of file write below lines and save it.

export ANT_HOME=/opt/apache-ant-1.9.2
export PATH=$PATH:$ANT_HOME/bin

Once you are done with /etc/profile file editing, you need to run below command to set variable's value.

source /etc/profile

5. Once you are done with above command, you can check ANT_HOME variable value with echo command.
for example:

-bash-3.2$ echo $ANT_HOME
/opt/apache-ant-1.9.2

Done.

Download Oracle JDK using Wget

Downloading Oracle Jdk becomes pain when you want to download it in shell prompt using wget command.
Since oracle does not allow to download oracle jdk without accepting agreement, only wget command will not help you without some other extra switches.

Finally I have found how we can download Oracle JDK in remote server in shell using wget command. Below command can be used to download.