Windows tuning, running the "server" Java VM (tuning)

Issue

By default Windows will run the client version of the Java runtime environment. The Wowza Pro server will function better when using the server version of the Java runtime environment that ships with the Java JDK. Below are the instructions to switch to the server version of the Java runtime environment.

Resolution

  • If you have the Java runtime environment installed (rather than the Java Development Kit - JDK) then unstinstall the Java runtime environment and install the most recent version of the Sun Java Development Kit (http://java.sun.com).

  • After installation delete the following files from the C:\WINDOWS\SYSTEM32 folder:

    java.exe
    javacpl.cpl
    javaw.exe
    javaws.exe
    
    
  • Add the path to the Java Development Kit to your system PATH variable. You can do this by doing the following:

  • Open the System Control Panel

  • Select the Advanced tab

  • Click the Environment Variables button

  • Double click the Path variable in the System variable section and add the full path the Java JDK bin folder inside the JDK folder surrounded by double quotes to the end of the list of path entries (path entries are separated by the ; character). For example, the string you add to the Path variable might look like this:

    ;"C:\Program Files\Java\jdk1.6.0_04\bin"
    
    
  • To test that is is working, open a command prompt and enter the following command:

    java -server -version
    

    It should return something similar to:

    java version "1.6.0_04"
    Java(TM) SE Runtime Environment (build 1.6.0_04-b12)
    Java HotSpot(TM) Server VM (build 10.0-b19, mixed mode)
    
    
  • With this in place you can now edit two Wowza Pro startup files to switch to the server VM.

    Edit [install-dir]/bin/setenv.bat

    change:
    set JAVA_OPTS=-Xmx768M
    to:
    set JAVA_OPTS=-server -Xmx768M
    
    

    Edit [install-dir]/bin/WowzaMediaServerPro-Service.conf

    change:
    # Java Additional Parameters
    wrapper.java.additional.1=-Dcom.wowza.wms.AppHome="%WMSAPP_HOME%"
    wrapper.java.additional.2=-Dcom.wowza.wms.ConfigHome="%WMSCONFIG_HOME%"
    wrapper.java.additional.3=-Dcom.wowza.wms.ConfigURL=
    wrapper.java.additional.4=-Dcom.sun.management.jmxremote=true
    wrapper.java.additional.5=-Dorg.tanukisoftware.wrapper.WrapperManager.mbean=true
    wrapper.java.additional.6=-Dorg.tanukisoftware.wrapper.WrapperManager.mbean.testing=false
    #wrapper.java.additional.7=-Dcom.sun.management.jmxremote.port=1099
    #wrapper.java.additional.8=-Dcom.sun.management.jmxremote.authenticate=false
    #wrapper.java.additional.9=-Dcom.sun.management.jmxremote.ssl=false
    #wrapper.java.additional.10=-Dcom.sun.management.jmxremote.password.file="%WMSCONFIG_HOME%/conf/jmxremote.password"
    #wrapper.java.additional.11=-Dcom.sun.management.jmxremote.access.file="%WMSCONFIG_HOME%/conf/jmxremote.access"
    #wrapper.java.additional.12=-Djava.rmi.server.hostname=192.168.1.7
    to:
    # Java Additional Parameters
    wrapper.java.additional.1=-Dcom.wowza.wms.AppHome="%WMSAPP_HOME%"
    wrapper.java.additional.2=-Dcom.wowza.wms.ConfigHome="%WMSCONFIG_HOME%"
    wrapper.java.additional.3=-Dcom.wowza.wms.ConfigURL=
    wrapper.java.additional.4=-Dcom.sun.management.jmxremote=true
    wrapper.java.additional.5=-Dorg.tanukisoftware.wrapper.WrapperManager.mbean=true
    wrapper.java.additional.6=-Dorg.tanukisoftware.wrapper.WrapperManager.mbean.testing=false
    wrapper.java.additional.7=-server
    #wrapper.java.additional.7=-Dcom.sun.management.jmxremote.port=1099
    #wrapper.java.additional.8=-Dcom.sun.management.jmxremote.authenticate=false
    #wrapper.java.additional.9=-Dcom.sun.management.jmxremote.ssl=false
    #wrapper.java.additional.10=-Dcom.sun.management.jmxremote.password.file="%WMSCONFIG_HOME%/conf/jmxremote.password"
    #wrapper.java.additional.11=-Dcom.sun.management.jmxremote.access.file="%WMSCONFIG_HOME%/conf/jmxremote.access"
    #wrapper.java.additional.12=-Djava.rmi.server.hostname=192.168.1.7
    
    

    Note: If you have uncommented some of these entries to turn on the JMX interface then you need to make sure the entries remain numbered in serial order. So if you have uncommented all of these entries then you need to add the server entry to the end of the list like this:

    # Java Additional Parameters
    wrapper.java.additional.1=-Dcom.wowza.wms.AppHome="%WMSAPP_HOME%"
    wrapper.java.additional.2=-Dcom.wowza.wms.ConfigHome="%WMSCONFIG_HOME%"
    wrapper.java.additional.3=-Dcom.wowza.wms.ConfigURL=
    wrapper.java.additional.4=-Dcom.sun.management.jmxremote=true
    wrapper.java.additional.5=-Dorg.tanukisoftware.wrapper.WrapperManager.mbean=true
    wrapper.java.additional.6=-Dorg.tanukisoftware.wrapper.WrapperManager.mbean.testing=false
    wrapper.java.additional.7=-Dcom.sun.management.jmxremote.port=1099
    wrapper.java.additional.8=-Dcom.sun.management.jmxremote.authenticate=false
    wrapper.java.additional.9=-Dcom.sun.management.jmxremote.ssl=false
    wrapper.java.additional.10=-Dcom.sun.management.jmxremote.password.file="%WMSCONFIG_HOME%/conf/jmxremote.password"
    wrapper.java.additional.11=-Dcom.sun.management.jmxremote.access.file="%WMSCONFIG_HOME%/conf/jmxremote.access"
    wrapper.java.additional.12=-Djava.rmi.server.hostname=192.168.1.7
    wrapper.java.additional.13=-server
    
    

    Charlie

My /WowzaMediaServerPro-Service.conf file does not have what you have there… it has this…so what do i change this too

# Java Additional Parameters
# Make sure the uncommented items are numbered sequentially
wrapper.java.additional.1=-Xmx768M
wrapper.java.additional.2=-Dcom.wowza.wms.AppHome="%WMSAPP_HOME%"
wrapper.java.additional.3=-Dcom.wowza.wms.ConfigHome="%WMSCONFIG_HOME%"
wrapper.java.additional.4=-Dcom.wowza.wms.ConfigURL=
wrapper.java.additional.5=-Dcom.sun.management.jmxremote=true
wrapper.java.additional.6=-Dorg.tanukisoftware.wrapper.WrapperManager.mbean=true
wrapper.java.additional.7=-Dorg.tanukisoftware.wrapper.WrapperManager.mbean.testing=false
# If running JDK, uncomment to run server environment (faster)
wrapper.java.additional.8=-server
# Better garbage collection setting to avoid long pauses
#wrapper.java.additional.9=-XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:NewSize=1024m
#wrapper.java.additional.10=-Djava.rmi.server.hostname=192.168.1.7
#wrapper.java.additional.11=-Dcom.sun.management.jmxremote.port=1099
#wrapper.java.additional.12=-Dcom.sun.management.jmxremote.authenticate=false
#wrapper.java.additional.13=-Dcom.sun.management.jmxremote.ssl=false
#wrapper.java.additional.14=-Dcom.sun.management.jmxremote.password.file="%WMSCONFIG_HOME%/conf/jmxremote.password"
#wrapper.java.additional.15=-Dcom.sun.management.jmxremote.access.file="%WMSCONFIG_HOME%/conf/jmxremote.access"

Thanks for the information…:wink:

I had to update the JAVA_HOME environment variable as well. The server wouldn’t start without it.

I’m running Wowza 3.1 on Windows Server 2008 R2 Standard, 64 bit, 8GB Ram

C:\Users\administrator>java -server -version

java version “1.7.0_05”

Java™ SE Runtime Environment (build 1.7.0_05-b06)

Java HotSpot™ 64-Bit Server VM (build 23.1-b03, mixed mode)

Question 1: Is it still necessary to add the -server syntax to the following code below? In my System variable I did not add to the Path variable ;“C:\Program Files\Java\jdk1.6.0_04\bin”. There was a JAVA_HOME variable pointing to C:\Program Files\Java\jdk1.7.0_05. For my setup would it be correct to simply change 768 to 4000?

On code:

change:

set JAVA_OPTS=-Xmx768M

to:

set JAVA_OPTS=-server -Xmx768M

Questions 2:

On WowzaMediaServer-Service.conf, do I need to add -server syntax to the code following code?

wrapper.java.additional.1=-Xmx4000M

or

wrapper.java.additional.1=-server -Xmx4000M

I believe this file has changed since this tutorial’s been originally posted and I’m guessing the current method is to simply change the wrapper.java.additinal.1 code.

Question 3:

How do I verify that everything is functioning correctly once I make these changes?

I’ve been following this tutorial https://www.wowza.com/docs/general-tuning and getting confused on Step 5 regarding the use of -server syntax. I’ve tried with and without on the set JAVA_OPTS= code and without on wrapper.java.additional.1 and both work, but I can’t tell if I’m gaining anything in performance. I don’t want to find out the hard way when streaming live and all of a sudden my system decides to not work.

How does the server version improve performance over the client version of the Java runtime. We have tested both and see little if any preformance differences.

Thanks

I believe it is just setting/config differences. The gc settings are better for shorter gc pauses but more frequent gc runs. The client is optimized for fast startup time.

Charlie

Check the Wowza environment variables for a slash:

https://www.wowza.com/forums/showthread.php?t=6332#10

Richard

No, the actual environment variables, in System Properties> Advanced> Environment variables > System variables, scroll down. They sometimes end up with slash at the end.

Richard

What is the problem you are having now?

Richard

Looks okay. Be careful with those GC options. The general tuning guide guide recommends not using special GC options unless you are having problems with memory.

Richard

What exactly did you update…My server isnt starting, maybe this would help

For a more detailed peek inside the HotSpot JVM you can add these settings to WowzaMediaServerPro-Service.conf

wrapper.java.additional.12=-verbose:gc

wrapper.java.additional.13=-XX:+PrintGCDetails

wrapper.java.additional.14=-XX:+PrintGCDateStamps

wrapper.java.additional.15=-XX:+PrintHeapAtGC

wrapper.java.additional.16=-XX:+PrintTenuringDistribution

wrapper.java.additional.17=-Xloggc:"%WMSAPP_HOME%"\logs\heap.log

This produces a heap.log in the logs directory with information about what HotSpot is doing with the heap.

Shows OldGen, YoungGen, PermGen sizes along with the frequency and duration of minor and major gc’s

Sorry to revive an old thread, but I have the exact same question… did this ever get answered?

My /WowzaMediaServerPro-Service.conf file does not have what you have there… it has this…so what do i change this too

# Java Additional Parameters
# Make sure the uncommented items are numbered sequentially
wrapper.java.additional.1=-Xmx768M
wrapper.java.additional.2=-Dcom.wowza.wms.AppHome="%WMSAPP_HOME%"
wrapper.java.additional.3=-Dcom.wowza.wms.ConfigHome="%WMSCONFIG_HOME%"
wrapper.java.additional.4=-Dcom.wowza.wms.ConfigURL=
wrapper.java.additional.5=-Dcom.sun.management.jmxremote=true
wrapper.java.additional.6=-Dorg.tanukisoftware.wrapper.WrapperManager.mbean=true
wrapper.java.additional.7=-Dorg.tanukisoftware.wrapper.WrapperManager.mbean.testing=false
# If running JDK, uncomment to run server environment (faster)
wrapper.java.additional.8=-server
# Better garbage collection setting to avoid long pauses
#wrapper.java.additional.9=-XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:NewSize=1024m
#wrapper.java.additional.10=-Djava.rmi.server.hostname=192.168.1.7
#wrapper.java.additional.11=-Dcom.sun.management.jmxremote.port=1099
#wrapper.java.additional.12=-Dcom.sun.management.jmxremote.authenticate=false
#wrapper.java.additional.13=-Dcom.sun.management.jmxremote.ssl=false
#wrapper.java.additional.14=-Dcom.sun.management.jmxremote.password.file="%WMSCONFIG_HOME%/conf/jmxremote.password"
#wrapper.java.additional.15=-Dcom.sun.management.jmxremote.access.file="%WMSCONFIG_HOME%/conf/jmxremote.access"

Just like trini_tech, my default .conf file doesn’t match the documentation above, and as a result, I’m not sure what to do.

Instead of copying and pasting from step 5 above, I uncommented the wrapper.java.additional etc… lines, so that I have:

# Java Additional Parameters
# Make sure the uncommented items are numbered sequentially
wrapper.java.additional.1=-Xmx768M
wrapper.java.additional.2=-Dcom.wowza.wms.AppHome="%WMSAPP_HOME%"
wrapper.java.additional.3=-Dcom.wowza.wms.ConfigHome="%WMSCONFIG_HOME%"
wrapper.java.additional.4=-Dcom.wowza.wms.ConfigURL=
wrapper.java.additional.5=-Dcom.sun.management.jmxremote=true
wrapper.java.additional.6=-Dorg.tanukisoftware.wrapper.WrapperManager.mbean=true
wrapper.java.additional.7=-Dorg.tanukisoftware.wrapper.WrapperManager.mbean.testing=false
# If running JDK, uncomment to run server environment (faster)
wrapper.java.additional.8=-server
# Better garbage collection setting to avoid long pauses
wrapper.java.additional.9=-XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:NewSize=1024m
wrapper.java.additional.10=-Djava.rmi.server.hostname=192.168.1.7
wrapper.java.additional.11=-Dcom.sun.management.jmxremote.port=1099
wrapper.java.additional.12=-Dcom.sun.management.jmxremote.authenticate=false
wrapper.java.additional.13=-Dcom.sun.management.jmxremote.ssl=false
wrapper.java.additional.14=-Dcom.sun.management.jmxremote.password.file="%WMSCONFIG_HOME%/conf/jmxremote.password"
wrapper.java.additional.15=-Dcom.sun.management.jmxremote.access.file="%WMSCONFIG_HOME%/conf/jmxremote.access"

…but now performance is slower than the default, especially for Cupertino streaming. I’m happy to run the default config, but the docs mention that this isn’t recommended for production use.

Hi multibc,

The purpose of this thread is to ensure that you are running the “server VM” as opposed to the “client VM”. In Windows this can be tricky because even though you install the JDK, some versions of Windows will still use the default “client VM” that comes with Windows.

You can run “java -server -version” in DOS (step 4) to see if your environment is set up to use the JDK or the JRE. You can only use the server flag when you are running the JDK.

If you do not see “Server VM” when you run that command, then you need to remove the JRE and install the JDK, and ensure that your PATH environment variable points to the JDK bin directory. You can search the net for how to set the path for your particular operating system. For example, you could search google for “How do I set the path in Windows 2008?”

“CET comment server INFO 200 - Java Name: Java HotSpot™ 64-Bit Server VM”

Ok, that looks good. You have it setup correctly.

JAVA_HOME = “C:\Program Files\Java\jdk1.7.0_01”

path = “;C:\Program Files\Java\jdk1.7.0_01\bin”

You’ll want the path ENV var to point to the bin directory so you can run the java executable. This is different from the JAVA_HOME var which points to the directory containing bin.

You can search google for how to set the path for your OS.

You can see here for definition of path: http://en.wikipedia.org/wiki/Path_%28computing%29

You don’t need to create a new one. There should be a “path” environment variable. You just need to append to it. Usually this is done when you install Java.

hello,

i have follow all points, so when start the server appear this question :

“Would you like the JAVA_HOME environment variable updated to point to this Java environment?”

this after modify point #3 in this guide. just press ‘yes’ and the server reset the variable path like :

C:\Program Files\Java\jdk1.7.0_01

is correct that the server resetting the value @ original condition ?

the path must be

C:\Program Files\Java\jdk1.7.0_01

to

C:\Program Files\Java\jdk1.7.0_01;“C:\Program Files\Java\jdk1.7.0_01\bin” ??

anyway, in the server logs appear :

CET comment server INFO 200 - Java Name: Java HotSpot™ 64-Bit Server VM

so, i’m sure that running server version ?

thanks

stefano

hello,

so, i need create a new entry : path = “;C:\Program Files\Java\jdk1.7.0_01\bin” in System Properties->Advanced->Environment Variables->Systems variables ??

i don’t understand where i need put this path…

stefano