Java VisualVM
For quick analysis of the options and health of a Java VM I used the jconsole tool, that is part of the Java SDK.
Now there is also VisualVM, that not only provides information about the options and health (CPU, Memory), but also a useful overview of the threads including their state and finally easy access to CPU and memory profiling.
See http://visualvm.java.net/ for details. To start this tool use the command jvisualvm instead of jconsole and select the Java VM that is your object.
Alfresco eats Memory – Yum, Yum
I recently tried to optimize an Alfresco 4 installation in a 1GB Ubuntu VM and reduction of the default 512m for MaxPermSize was too much, the Tomcat instance goes down after startup and first call to /alfresco.
Considering the remaining memory for the PostgreSQL database, OpenOffice and the operating system, I thought about reduction of Heap and PermSize limits for the Tomcat instance included in the Alfresco installation. Setting the Heap Maximum to 512m instead of 1024m was not the problem, but using 128m for MaxPermSize instead of the 512m killed the instance after the first call to /alfresco.
So better don't touch MaxPermSize in tomcat/scripts/ctl.sh.
Also 1GB of RAM is not recommended for an Afresco VM, better start with 2GB of RAM. The startup of Alfresco currently takes up to 4-5 minutes, shutdown is not faster, which makes reboots of the VM taking 10 minutes even though the VM is restarted within seconds, it's the Alfresco that gives the delay.
Java 7 for Ubuntu
Ubuntu announced to discontinue packaging of Sun/Oracle's Java for Ubuntu, because Oracle changed the licensing.
Please be careful with upgrades on these packages, since it may drop your Java installation on the system, not only the browser plug-in.
So I followed these steps to establish Java 7 support on my Ubuntu 10.04 LTS:
- Download
jdk-7*-linux-*.tar.gzfrom Oracle - Get privileges:
sudo bash - Extract the archive:
tar -C /usr/lib/jvm -zxf jdk-7*-linux-*.tar.gz - Link to generic name java-7-oracle:
cd /usr/lib/jvm && ln -snf jdk1.7* java-7-oracle - Register Java commands using
update-alternatives:register-alternatives.sh - If you have a 32Bit-Linux, changed the downloaded .sh-script appropriately, i.e. replace amd64 by i386:
sed -i -e 's/amd64/i386/g' register-alternatives.sh - Prepare
/usr/lib/jvm/.java-7-oracle.jinfo. - Mind the name, it begins with a dot.
- If you have a 32Bit-Linux, change the downloaded .jinfo-file appropriately, i.e. replace amd64 by i386:
sed -i -e 's/amd64/i386/g' /usr/lib/jvm/.java-7-oracle.jinfo - Switch Java release:
update-java-alternatives --set java-7-oracle
Check the Installation
- On the command line you can check the Java version by simply calling:
java -version - In the browser, just follow testjava.jsp.
- In a Firefox you can also see a related Java entry in the about:plugins.
Updates
Since the default Java release is no longer bound to the Ubuntu packaging, you have to take care of updates on your own.
Choose some channel (e.g. heise security, Oracle Security Alerts) to at least watch out for security-related updates.
An update itself should be fairly easy, repeat the first steps of the installation:
- Download
jdk-7*-linux-*.tar.gzfrom Oracle - Get privileges:
sudo bash - Extract the archive:
tar -C /usr/lib/jvm -zxf $(ls -t jdk-7*-linux-x64.tar.gz | head -1)
- Link to generic name java-7-oracle:
cd /usr/lib/jvm && ln -snf $(ls -td jdk1.7* | head -1) java-7-oracle