Wowza Community

Dual instances with loadbalancing

We have a server with a 10Gb nic and we want to fully utilize that capacity by using two instances of wowza streaming engine, but my question is regarding how to do it.

To start with i want to have one of the instances to have an origin application with loadbalancerlistener and transcoding enabled + an edge application with loadbalancersender pulling from the origin application on the same instance.

Then i want the second instance to just have an edge application with loadbalancersender pulling from the origin on the first instance.

So i am wondering do i have to have separate ip addresses for the instances since the loadbalancer addon communicates via port 1934 or can it be done in another way?

And the second question is do i still have to copy smil files to the second instance even though everything is on the same physical server, and is there a way to automatically generate a SMIL file when a stream is published to the server?

Also, which way is best to use loadbalancer with Jw player when you are only streaming though HLS: “Get least loaded server using http” or “Get least loaded server using Netconnection redirect”?

And is there any example code of how to use the loadbalancer while using Jw player?

thanks in advance!

If you run multiple instances on one server you will want to split them up by IP address of which you can designate within your VHost.xml configuration file on each respective instance. Your load balancer configuration setup seems sound and you can have both instances report (as a sender) to the first instance load balancer listener over 1934.

To obtain the least loaded edge via http, you might checkout this forum post for some guidance.

Thanks,

Matt

okay so i ran into a problem with the setenv.bat file, when running 2 instances you have to modify this file but i dont quite understand how to do it.

The code looks like this:

@echo off

set _EXECJAVA=java

rem Setting of JAVA_OPTS has moved to conf/Tune.xml

set EXECCSCRIPT=cscript

if not exist “%SystemRoot%\SysWOW64\cscript.exe” goto skip64bitcscript

set EXECCSCRIPT="%SystemRoot%\SysWOW64\cscript.exe"

:skip64bitcscript

set WMSENVOK=“false”

rem Guess WMSAPP_HOME if not defined

set CURRENT_DIR=%cd%

if not “%WMSAPP_HOME%” == “” goto gotAppHome

set WMSAPP_HOME=%CURRENT_DIR%

if exist “%WMSAPP_HOME%\bin\startup.bat” goto okAppHome

cd …

set WMSAPP_HOME=%cd%

cd %CURRENT_DIR%

:gotAppHome

if exist “%WMSAPP_HOME%\bin\startup.bat” goto okAppHome

if “%~1”==“service” (

echo setenv.bat: The WMSAPP_HOME environment variable is missing or not defined correctly: “%WMSAPP_HOME%”. This environment variable is needed to run the server. >> batch.log

) else (

%EXECCSCRIPT% “displaymsg.vbs” “The WMSAPP_HOME environment variable is missing or not defined correctly (%WMSAPP_HOME%). This environment variable is needed to run the server.”

)

goto end

:okAppHome

rem Guess WMSCONFIG_HOME if not defined

set CURRENT_DIR=%cd%

if not “%WMSCONFIG_HOME%” == “” goto gotConfigHome

set WMSCONFIG_HOME=%WMSAPP_HOME%

if exist “%WMSCONFIG_HOME%\conf\Server.license” goto okConfigHome

cd …

set WMSCONFIG_HOME=%cd%

cd %CURRENT_DIR%

:gotConfigHome

if exist “%WMSCONFIG_HOME%\conf\Server.license” goto okConfigHome

if “%~1”==“service” (

echo setenv.bat: The WMSCONFIG_HOME environment variable is missing or not defined correctly: “%WMSCONFIG_HOME%”. This environment variable is needed to run the server. >> batch.log

) else (

%EXECCSCRIPT% “displaymsg.vbs” “The WMSCONFIG_HOME environment variable is missing or not defined correctly (%WMSCONFIG_HOME%). This environment variable is needed to run the server.”

)

goto end

:okConfigHome

if “%~1”==“service” (

if “%JAVA_HOME%”=="" (

echo setenv.bat: JAVA_HOME is not set. “%JAVA_HOME%” >> batch.log

goto end

)

if NOT EXIST “%JAVA_HOME%\bin\java.exe” (

echo setenv.bat: JAVA_HOME is set incorrectly?. “%JAVA_HOME%” >> batch.log

goto end

)

echo setenv.bet: JAVA_HOME is: “%JAVA_HOME%” >> batch.log

) else (

%EXECCSCRIPT% “checkjavahome.vbs” //Nologo

if not %errorlevel% == 0 goto end

)

set WMSENVOK=“true”

set _EXECJAVA=%JAVA_HOME%\bin\java.exe

:end

and as i understand it i want to change WMSAPP_HOME and WMSCONFIG_HOME so it points to the new instance (C:\Program Files (x86)\Wowza Media Systems\Wowza Instance 2). how exactly do i do that?

i have read this guide: https://www.wowza.com/docs/how-to-run-multiple-instances-of-wowza-media-server-on-one-computer but as i said i dont quite understand how to change theese two pointers anyway

thanks in advance

yes thank you, that worked great, now i am having some trouble with the wowza streaming engine manager though, this guide is outdated with regards to it: https://www.wowza.com/docs/how-to-run-multiple-instances-of-wowza-media-server-on-one-computer is it possible to run 2 separate managers, one for each instance? if so, how do i configure that, i have tested but i only get one to work myself?

Never mind, solved it, when i tried to assign them to specific ip addresses it gave me lots of java errors, so i kept the “*” for the ip address property and gave them unique ports instead

You will want to define something similar to the following at the top of that script under “@echo off” as follows:

@echo off
set WMSAPP_HOME=C:\Path\to\WowzaMediaserver-instance2
set WMSCONFIG_HOME=C:\Path\to\WowzaMediaserver-instance2
... Rest of .bat file to follow...