I recently went and brought a VPS from burst.net  Basic specs are 2x 2500Mhz CPU cores, 2.5gb guaranteed memory (no burstable).

This should be more then enough I though to run Zimbra OCS after all I have it up and running in a Test VM running on ESXi with only 1gb of memory and 1 cpu core.

What I did not release is that when a Java server process starts up, you can define how much memory it grabs and what size of memory chunks it asks for. Out of the box install of Zimbra optimise's it self for the total amount of system memory in my case 2.5gb. So when the ZImbra  application stack goes to start on my OpenVZ VPS it comes up with an fail " Can not create Java Virtual machine, out of memory"

Out of memory wtf!

The Java stack expects to be able to grab a contiguous chunk of memory, in my case 1.5gb. Because of the underlying OpenVZ and the way it handles memory its not possible for a OpenVZ VPS instance to have a contiguous block of memory. Hence why the JVM was crashing, Originally it was asking for 3x 512mb blocks of contiguous memory. My VPS could not do this, you could edit the OpenVZ settings to allow bigger "chunks" of memory to be offered up. Since I have no control over this I had to tell Java to ask for more lots of smaller chunks of memory.

If your trying to get around the errors. Do the following.

  1. Install Zimbra but do not start any of the services and or application stack after configuration.

  2. Change to the zimbra user and  enter the following commands :

# su - zimbra
# zmlocalconfig -e mailboxd_java_options="-server -Djava.awt.headless=true -XX:+UseConcMarkSweepGC -XX:NewRatio=2 -XX:PermSize=128m \
-XX:MaxPermSize=128m -XX:SoftRefLRUPolicyMSPerMB=1 -Xms128m -Xmx128m"
<em> # zmlocalconfig -e tomcat_java_heap_memory_percent=5
# zmlocalconfig -e zmmtaconfig_interval=3600
# zmlocalconfig -e zmstat_interval=300
# zmlocalconfig -e mailboxd_java_heap_memory_percent=5
# zmlocalconfig -e mailboxd_java_heap_new_size_percent=5
# zmlocalconfig -e ldap_common_threads=16
# zmlocalconfig -e ldap_common_toolthreads=8
# zmlocalconfig -e ldap_db_cachesize=50000
# zmlocalconfig -e ldap_db_idlcachesize=50000
# zmlocalconfig -e ldap_db_dncachesize=0
# zmlocalconfig -e zimbra_zmjava_options="-Xms128m -Xmx128m"
# zmprov mcf zimbraMessageCacheSize 5000
  1. Now we need to tune some of the non Zimbra apps, Change back to the root user for this. Edit the following files :
# vim /opt/zimbra/conf/amavisd.conf.in

Edit the folowing :

$max_servers =10
and set it to
$max_servers =2
# vim /opt/zimbra/conf/my.cnf

Edit/add the following :

"innodb_buffer_pool_size =" to "innodb_buffer_pool_size = 144245094"
"thread_cache = " to "thread_cache = 5"
"max_connections   = " to "max_connections   = 15"

I've now got Zimbra OCS up and running in a VPS. So far its been very stable and preforms quite fine for my work load.