Zimbra OCS on a OpenVZ VPS Server

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.
Commands to type are in italics

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”

# 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

Now we need to tune some of the non Zimbra apps, Change back to the root user for this.
Edit the following files
# nano /opt/zimbra/conf/amavisd.conf.in
Edit the folowing
“$max_servers =10” and set it to “$max_servers =2”

# nano /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.

References for the above :-


7 Responses to “Zimbra OCS on a OpenVZ VPS Server”

  1. […] Zimbra OCS on a OpenVZ VPS Server […]

  2. Good Submission,
    Very rarely do you get as good a set of clear views on the Web-Hosting industry. Well Done!
    appreciate the read! Will read again!

  3. Very good information, though, i have a problem: every single time i try to install Zimbra, at the end of the instalation it tries to start the services (i cant find a way to prevent it) and that messes up the VM, so i cant run the commands aftwerwards(keeps saying cannot create virtual machine), so i try restarting the VPS and the VM is still messed up(i guess becouse it tries to start up zimbra again), what can i do in this scenario?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: