Home > Flash Streaming > Red5 on a VPS?

Red5 on a VPS?

January 31st, 2007

Well today I thought I would sit down and try and get Red5 0.6rc to install on my mediatemple VPS account so that I might abuse the terrabyte of bandwidth I have at my disposal.

Might I mention that I’ve spent quite a bit of time trying to get FMS2.0.3 to install on this VPS and that my final assessment of the situation is that FMS just doesn’t like VPS accounts (or at least ones powered by Virtuosso). In /var/messages it reports that the server process cannot create a mutex. Considering a mutex (from what I understand) is a universal shared object that can only be access by a single thread at a time, then I can only assume that the VPS restricts the creation of mutexes at the system level – thus being the problem. On a side note, if anyone has managed to get FMS2 to run under a VPS or has gotten by this problem I would be very interested.

Getting back on track: Red5 VPS installation. After installing Apache Ant and JDK1.5 I attempting to compile Red5 but encountered the following error:


Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.

I did a bit of research and learned that the java VM uses the max system memory as a way to build the heap. It turned out that you can use the following flags to limit the memory usage of the VM

java -Xms48m -Xmx96

48m and 96m are the min and max memory the VM is allowed to use. In order to get ant to use these flags when building the Red5 source you have to export the following:


export ANT_OPTS='-Xms48m -Xmx64m'

So if you were setting up your paths in your bash profile it would all look something like this:


# .bash_profile# Get the aliases and functions

if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

# User specific environment and startup programs
PATH=$PATH:$HOME/bin
BASH_ENV=$HOME/.bashrc
USERNAME=”root”
export USERNAME BASH_ENV PATH
export ANT_HOME=/usr/local/ant
export JAVA_HOME=/usr/local/java/jdk1.5.0
export PATH=${PATH}:${ANT_HOME}/bin
export ANT_OPTS=’-Xms48m -Xmx64m’
After making these changes I was able to run ant, but it seems that my VPS, having only 75mb of free memory, couldn’t handle the compile. ‘ant -verbose server’ generated the following error:


[javac] Error occurred during initialization of VM
[javac] Could not create the Java virtual machine.
[javac] Could not reserve enough space for object heap BUILD FAILED

This looks like the same memory alocation issue that we had already, but this time with javac.

This is where I’ve had to stop. I’m not quite sure yet how to restrict memory usage for javac within the compile process – if anyone has any thoughts or ideas I’d like to hear them.

Ideally I’d like to turn my efforts into a tutorial for Red5 users who want to utilize a VPS. We’ll see where it goes from here.

ian Flash Streaming

  1. Lu
    May 11th, 2007 at 20:22 | #1

    Found ur post through google just before i sorted my VPS by luck.
    i tried this:

    # export _JAVA_OPTIONS=’-Xms32m -Xmx56m -Xss128k -XX:PermSize=32m -XX:MaxPermSize=64m’
    # export ANT_OPTS=’-Xms32m -Xmx56m -Xss128k -XX:PermSize=32m -XX:MaxPermSize=64m’

    to start,
    # bash red5.sh

    good luck!

  1. June 20th, 2007 at 11:32 | #1
You must be logged in to post a comment.