• How to do performance tuning

    This article provides suggestions for tuning Wowza media server software on your production hardware.


    Tuning Wowza Streaming Engine
    Tuning Wowza Media Server


    By default, Wowza Streaming Engine™ software (version 4.2 and later) is automatically installed with a supported version of Java and is tuned to a development state optimized for the hardware on which it's running. The server can be tuned to a production level by adjusting the Java settings. Knowing that the server is running to the best of its ability makes Wowza Streaming Engine easy to deploy in a production environment. Advanced users can alter the tuning further by using Wowza Streaming Engine Manager, if required.

    Note: If you're running Wowza Streaming Engine software version 4.1.2 (or earlier) or Wowza Media Server™ software, you'll get best results if you run the most recent Oracle Java Development Kit (JDK). Your best option is to run a 64-bit OS with the 64-bit Java VM, which enables Java heap sizes greater than 2 GB. For details, see How to manually install and troubleshoot Java with Wowza Streaming Engine.

    Tuning Wowza Streaming Engine

    By default, Wowza Streaming Engine Manager can be accessed by using the following URL:


    In Streaming Engine Manager, click the Server tab at the top of the page, and then select Performance Tuning in the contents panel. The Performance Tuning page shows the server's OS architecture, amount of memory available to Streaming Engine, the number of core processors on the system, and the Java version and architecture (bitness) in use.

    Java Settings

    Click Java Settings in the contents panel. The Java Settings page shows the current Java settings, including the Java Heap Size, which is the amount of memory allocated to Wowza Streaming Engine, and the Java Garbage Collection Settings.

    To change these settings, click Edit. Both Java Heap Size and Java Garbage Collection Settings have three options to choose from. To run a dedicated server in a production environment, choose Production level for the Java Heap Size and Concurrent collector for the Java Garbage Collection Settings, and then click Save. The default for the Java Heap Size is the Development level. If you're using this server to run other services that have high memory consumption, you may want to choose Custom level for the Java Heap Size and enter a specific value.

    Restart Wowza Streaming Engine so that your changes take effect. If you aren't using a dedicated server or you want to manually tune Wowza Streaming Engine further, see the options described below.

    Server Thread Pools

    Click Server Thread Pools in the contents panel. The Server Thread Pools page shows the current Handler Thread Pool Size and Transport Thread Pool Size.

    To change these settings, click Edit. When left at Set automatically, Wowza Streaming Engine calculates the Handler Thread Pool Size and Transport Thread Pool Size as follows:

    Handler Thread Pool Size = 60 x Processor Cores

    Transport Thread Pool Size = 40 x Processor Cores

    Note: The Processor Cores value appears on the Performance Tuning page.

    Media Cache Tuning

    Click Media Cache Tuning in the contents panel. Media Cache Tuning settings apply to VOD Edge applications. They include the current Writer Thread Pool, Readahead Thread Pool, Maximum Pending Write Request Size, and Maximum Pending Readahead Request Size.

    To change these settings, click Edit. When left at Set automatically, Wowza Streaming Engine calculates the Writer Thread Pool and Readahead Thread Pool as follows:

    Writer Thread Pool = 2 x Processor Cores

    Readahead Thread Pool = 1 x Processor Cores

    Maximum Pending Write Request Size and Maximum Pending Readahead Request Size are calculated based on the Java Heap Size.

    Java Heap Size 1200 MB to 3999 MB 4000 MB to 7999 MB 8000 MB or greater
    Maximum Pending Write Request Size 160 MB 500 MB 1000 MB
    Maximum Pending Readahead Request Size 80 MB 250 MB 500 MB

    Virtual Host Processors

    Click Virtual Host Processors in the contents panel. The Virtual Host Processors page shows the number of threads used at the VHost level to service various types of connections.

    To change the settings, click Edit. When left at Set automatically, Wowza Streaming Engine calculates the values as follows:

    Net Connections Processor Count = 2 x Processor Cores

    Media Caster Processor Count = 2 x Processor Cores

    Idle Worker Count = 2 x Processor Cores

    Unicast Incoming Processor Count = 2 x Processor Cores

    Unicast Outgoing Processor Count = 2 x Processor Cores

    Multicast Incoming Processor Count = 2 x Processor Cores

    Multicast Outgoing Processor Count = 2 x Processor Cores

    The Client Idle Frequency is the time (in milliseconds) between idle events for Adobe Flash client connections. For basic on-demand streaming, 250 ms provides the best reliability-to-performance ratio. For live, low-latency streaming, 125 to 250 ms is better. If you aren't doing low-latency streaming, Client Idle Frequency can be increased to 500, which reduces the CPU usage and allows more concurrent connections. Values between 1 and 1000 are supported.

    The RTP Idle Frequency value is the time (in milliseconds) between idle events for RTP connections. Values between 1 and 1000 are supported.

    Virtual Host Ports

    The Virtual Host Ports page shows the current open ports and the processor count associated with each port.

    To change the settings, click Edit. When left at Set automatically, Wowza Streaming Engine sets the default processor counts as follows:

    Port 1935 Processor Count = 2 x Processor Cores

    Port 8086 Processor Count = 2 x Processor Cores

    Virtual Host Thread Pools

    Click Virtual Host Thread Pools in the contents panel. Virtual Host Thread Pools are required when running multiple virtual hosts (VHosts) on the server.

    If you're running multiple VHosts, configure the Handler Thread Pool Size and Transport Thread Pool Size to Use Server Settings. When configured to Use Server Settings, the handler and transport threads are divided equally between all of the active VHosts that are running on the server.

    Tuning Wowza Media Server

    Note: After editing any of the configuration files described in this section, restart the server so that the changes take effect.

    Java Heap Size

    The default Java heap size is 768 MB for Windows and 1200 MB for Linux and OS X?. These values are optimized for development and aren't large enough for high-volume production use. If you're running the 64-bit version of the Java VM and have 4 GB or more of RAM in your machine, set your Java heap size between 3000 MB to 5000 MB. If you have at least 16 GB of RAM, set your heap size to 8000 MB. Don't set your heap size above 10 GB, as this can lead to long garbage collection cycles/pauses. Memory settings can be adjusted in the following script files:

    • [install-dir]/bin/setenv.sh (Linux and OS X, around line 4)
    • [install-dir]/bin/setenv.bat (Windows Standalone and Windows Service, around line 4)
      set JAVA_OPTS=-Xmx3000M

    Garbage Collection

    Garbage collection (GC) tuning in Java is tricky. What works best in one server setup may not work in another. Through trial-and-error and customer feedback, we've developed several suggested approaches.

    First, we strongly recommend that you use no additional settings. The default tuning works well for many streaming situations and doesn't require modification.

    If, however, you're experiencing problems with the Java heap, such as a build-up of memory usage, you can try implementing one of the following garbage collection options:

    • Concurrent collector is designed for applications that prefer shorter GC pauses and that can share processor resources with the garbage collector while the application is running. The suggested additional settings are:

      If heap size is 5000 MB or greater, NewSize=512m

      If heap size is 3000 MB to 5000 MB, NewSize=256m

      If heap size is less than 3000 MB, NewSize=128m

      For example, with a 64-bit OS, 8 GB RAM, and heap size of 6000 MB:
      -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:NewSize=512m
    • G1 (Garbage-First) collector is designed for low pause time, high-throughput applications. The G1 collector is a server-style garbage collector targeted for multi-processor machines with large memories, and it's fully supported in Oracle JDK 7 Update 4 and later releases. The suggested additional settings are:

      -XX:+UseG1GC -XX:MaxGCPauseMillis=100

    To change the garbage collection settings, modify the following scripts:

    • [install-dir]/bin/setenv.sh (Linux and OS X, uncomment line 10). For example:
      JAVA_OPTS="$JAVA_OPTS -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:NewSize=512m"
    • [install-dir]/bin/setenv.bat (Windows Standalone and Windows Service, uncomment line 10). For example:
      set JAVA_OPTS=%JAVA_OPTS% -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:NewSize=512m
    • [install-dir]/bin/setenv.sh to monitor GC pause times for Linux, add:
      -verbose:gc -Xloggc:"/usr/local/WowzaMediaServer/logs/gc_%UNIQUE%.log" -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintHeapAtGC
    • [install-dir]/bin/setenv.sh to monitor GC pause times for OS X, add:
      -verbose:gc -Xloggc:"/Library/WowzaMediaServer/logs/gc_%UNIQUE%.log" -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintHeapAtGC
    • [install-dir]/bin/setenv.bat to monitor GC pause times for Windows, add:
      set JAVA_OPTS=%JAVA_OPTS% -verbose:gc -Xloggc:"c:\gc.log" -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintHeapAtGC -XX:+PrintGCApplicationConcurrentTime -XX:+PrintGCApplicationStoppedTime
      Note: On Windows, this creates a C:\gc.log file for debugging purposes and shouldn't be left running. The gc.log file is only created when starting the Wowza media server in service mode or if using the command line.

    Additional tuning

    • For low-latency chat applications, it's best to use smaller socket buffer sizes (16000 bytes for read and write). The socket buffer sizes are configured in [install-dir]/conf/VHost.xml:
    • In Linux, increase the maximum number of file descriptors. This addresses the "Too many files open" error message. To do this, edit the following two files:


      #ulimit -n 20000
      ulimit -n 20000


      #ulimit -n 20000
      ulimit -n 20000
      • This may fail on some versions of Linux or if you don't have permission to change the descriptor limit. If the Wowza media server won't start after making this change, consult the documentation for your Linux distribution to see how to increase the descriptor limit.

      • On some versions of Linux, there's also a limit in the kernel that may need to be increased. Consult the documentation for your distribution. You may need to add the following line to your /etc/sysctl.conf file:
    • In Linux, switch to using the Anticipatory elevator (as) elevator algorithm as described in Choosing an I/O Scheduler for Red Hat.

    • In Linux, mount your disk with the noatime option. This operation differs based on your Linux distribution. A description of the setting is available at The atime and noatime attribute.

    • To tune your server based on the available CPU resources of your server, use the following guidelines:

      The [total-core-count] refers to the total number of CPU cores in your server. For example, if you have dual quad-core processors (two quad-core processors), your [total-core-count] is 8.

      If your server supports hyper-threading, then use the total number of threads. If hyper-threading is available on a system with dual quad-core processors, for example, the total number of threads is:
      2 processors x 4 cores x 2 threads per core = 16
      With the number of cores and threads per physical processor continually growing, we suggest a maximum number of threads for each value below:

      In the configuration file [install-dir]/conf/VHost.xml:
      HostPort/ProcessorCount: 2 x [total-core-count] (maximum of 24)
      IdleWorkers/WorkerCount: 2 x [total-core-count] (maximum of 24)
      NetConnections/ProcessorCount: 2 x [total-core-count] (maximum of 24)
      RTP/UnicastIncoming/ProcessorCount: [total-core-count] (maximum of 12)
      RTP/UnicastOutgoing/ProcessorCount: 2 x [total-core-count] (maximum of 24)
      RTP/MulticastIncoming/ProcessorCount: [total-core-count] (maximum of 12)
      RTP/MulticastOutgoing/ProcessorCount: [total-core-count] (maximum of 12)
      HandlerThreadPool/PoolSize: (60 x [total-core-count]) (maximum of 480)
      TransportThreadPool/PoolSize: (40 x [total-core-count]) (maximum of 320)
      Note: Do not modify the HostPort ProcessorCount field in the Admin HostPort (/Port "8086").
      These configuration calculations assume that you have at least 1 GB of memory per core or--if you have four or more total cores--that you're running the 64-bit Java VM, and that you're using the suggested memory settings above.

    • If you're running more than one virtual host, resource allocations must be distributed between each VHost. The simplest approach to running more than one virtual host is to divide the settings listed above (which are intended for a single VHost) and distribute the resources across each VHost on your system. The settings don't have to be evenly divided; however, the total should equal what you would allocate if you were configuring for a single VHost. If one of your VHosts is idle most of the time, you may allocate more memory than the combined total. Be careful with this setting because excessive allocations are risky. An out-of-memory error occurs if both VHosts exceed the combined, available resources.

      Alternatively, you can set each VHost/HandlerThreadPool/PoolSize to "0" and VHost/TransportThreadPool/PoolSize to "0" in [install-dir]/conf/VHost.xml, which causes the [install-dir]/conf/Server.xml settings for these properties to be used instead. This instructs the Wowza media server to manage the PoolSize across all VHosts.

      A mixed approach can also be used with the [install-dir]/conf/VHost.xml file by setting the PoolSize to "0" for idle/minimal-use VHosts while using higher values for busy/high-performance VHosts with higher resource requirements.

    • If you aren't doing low-latency streaming and you have a client side buffer of 3 or more seconds (NetStream.bufferTime), you can reduce the CPU load on the machine and handle more concurrent sessions by editing [install-dir]/conf/VHost.xml and changing the following two values:

      IdleWorkers/CheckFrequency: 100
      Client/IdleFrequency: 500
    • If you're having problems with multiple incoming multicast streams interfering with each other on Linux, you may need to set the Java property java.net.preferIPv4Stack to true. To do this, edit [install-dir]/bin/setenv.sh and uncomment the following line (line 13):

      JAVA_OPTS="$JAVA_OPTS -Djava.net.preferIPv4Stack=true"
    • When streaming to the Adobe Flash player, it's important to try and avoid RTMPT (the tunneling version of RTMP). RTMPT uses a polling mechanism that's very chatty and CPU intensive. Instead of using RTMPT, use a protocol rollover strategy so that only connections that need RTMPT use it. This strategy is described in How to set up protocol rollover with ActionScript.

    • In Windows 7, Server 2003, or 2008, turn off TCP auto-tuning. For more information, see How to disable Windows Vista TCP/IP auto-tuning.

    Originally Published: 10-01-2010.
    Updated: For Wowza Streaming Engine 4.2 on 06-16-2015.

    If you're having problems or want to discuss this article, post in our forum.
    If this article has an error or needs improvement, leave a comment below.

    Comments 23 Comments
    1. notreg -
      Why only 3-5GB for heap? How it could be calculated?
    1. rrlanham -
      You can allocate more to java heap if you have it, and if you have 64bit OS and 64bit Java. If server is dedicated Wowza server allocate most available ram.

    1. alinutzelu -
      Yes, but "How it could be calculated?"
      It's any formula for occupied memory?
      I have 70 live http streams at 250kbps and wowza has reached at 2GB RAM (java process).

      Thank you
    1. rrlanham -
      Take a look at the tuning guide:


      The suggestions in this guide assume that the server is a dedicated Wowza server. If there are other applications that require a lot of memory, you would have to allow for that.

    1. charlie -
      Thanks for the info. We will amend this step.

    1. donASKet -
      > If you have 16 GB or more RAM, we suggest a heap size of 8000 MB. We do not suggest a heap size above 10 GB as it can lead to long GC cycles/pauses
      >This assumes you have at least 1GB of memory per core and that in the case you have 4 or more total cores you are running the 64-bit Java VM using the suggested memory settings above.

      But i have server with 16 core's. How much memory must i set for JVM Heap? 8GB or 16GB (1GB per core)? Server use for CDN (10-20 stream's with 500-2000 user's per stream)
    1. dptekco -
      This is a followup to donASKet's as well, with larger machines and interfaces do the tuning guides recommended limits still apply? In particular:

      - 10GB heap limit
      - If heap size is 5000 MB or greater, NewSize=512m, but at 10GB or higher, still 512m?
      - Do the various VHost.xml maximum values still hold with a 16+ core machine?
      - With Java 7, do you still recommend the default GC with -server option? With a beefed up machine running huge loads, are any of the optional GC's , including new G1 superior at keeping garbage collection from affecting streams?

      I know each must test , but I'm curious in regards to best practices already posted and if they still apply with larger machines (16+ cores, 20GB+ ram, 10gbit interface, sustaining over 6gbps throughput)
    1. romild0 -
      I would like to know that too. Btw, is there a big difference in java version 1.6 and 1.7?
    1. rrlanham -
      If you have multiple VHosts you do have to divide allocations between them. In most cases you can use multiple applications in one VHost and avoid this complication.

      You will have to look at Oracle's release notes for details on different Java versions, but we are recommending the latest 1.7 release for Wowza

    1. steveitl -
      i not understand, where i need put the code :

      -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:NewSize=512m

      in the setenv.bat or WowzaMediaServer-Service.conf ?

      so, using Win2k8 x64 i need put :

      [install-dir]/bin/setenv.bat (add at line 8, Windows).
      set JAVA_OPTS=%JAVA_OPTS% -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:+UseParNewGC

      and :

      [install-dir]/bin/WowzaMediaServer-Service.conf (Windows).
      wrapper.java.additional.[n]=-XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:+UseParNewGC

      is correct ?

    1. rrlanham -
      The GC lines go in /bin/setenv.bat

    1. steveitl -
      for complete configuration, in setenv.bat, two line :

      set JAVA_OPTS=%JAVA_OPTS% -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:+UseParNewGC

      and :

      -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:NewSize=512m

      in WowzaMediaServer-Service.conf, one line :

      wrapper.java.additional.[n]=-XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:+UseParNewGC

      is correct ?

    1. Erwin Leon Pentzke -
      Richard and/or Charlie:
      In order to follow this guide and tune the right way EC2 Wowza servers I need you to help me with this question:
      Which is the number of threads in the Amazon Web Services EC2 most frequently used instances? (m1.small, m1.large, m1.xlarge, etc)
      I know that the m1.large has two cores, but there is no information about hyper-threading.
      Thanks in advance,
    1. oletinani -

      Some times my system taking 100% CPU, after changing default port(1935) to some other(7756) it should be fine. after some days again error occured then also we changed the port from 7756 to 1935, then it should be fine.

      Please help on this.

    1. overture -
      I'm running multiple VHosts. CAn I set each VHost/HandlerThreadPool/PoolSize to "0" and VHost/TransportThreadPool/PoolSize to "0" and then configure only the /conf/Server.xml file?
      In this case How can I configure these settings?

    1. salvadore -
      Yes, you can set each VHost/HandlerThreadPool/PoolSize to "0" and VHost/TransportThreadPool/PoolSize to "0", which will cause the [install-dir]/conf/Server.xml settings for these properties to be used instead. This will instruct Wowza Media Server to manage the thread pool size across all VHosts.

      Although multiple applications is usually enough, consider that instead of multiple VHosts. Otherwise you should edit these files according to the tuning guide:
      Tuning Guide

    1. overture -
      Ok, now I'm running 20 Virtual Hosts. Which is the better configuration in the Server.xml?
      Now both HandlerThreadPool/PoolSize and TransportThreadPool/PoolSize are set to 10 as default values.
    1. rrlanham -
      With many VHosts you are going to have to test. It is impossible to recommend exact settings. Some VHosts may have different loads. The section on multiple VHosts in the tuning guide also suggests a mixed approach where some VHosts have specific values for the settings and others are set to "0" to let Wowza manage between them, as it would with multiple applications anyway. In most cases you can make the necessary separate with Applications, then not have to worry about this tuning aspect.

    1. tadung -
      Hi all,

      My Wowza streaming server with spec (using VPS):

      - 04 CPUs
      - RAM 16GB
      - HDD: 500GB, 7.2 rpm
      - NIC: 01Gbps
      - Internet (NIX): 512Mbps

      The only parameter that I configured:
      - Heapsize: 5000M (I just up to 8000M)

      After I checked this server on the system with tools: htop, top, free & others, I got the information:
      - CPU: ~5%
      - RAM: ~12-13GB used; ~2-3GB free
      - Each connection connects to this server, it occupied RAM ~600M
      - Connection concurrent users (CU): ~200
      (Sometimes, I must clear cahce/ram with "sync; echo 3 > /proc/sys/vm/drop_caches")

      So, I have questions for this issue:

      1. How to adjust the Heapsize with 16GBRAM? If I up to 32GBRAM, what's the Heapsize or other parameters?
      2. Can I decrease the memory that each connection occupy RAM? (Currently, it occupied ~600M)
      3. The system needs:
      - 500 CU at the same time, what about RAM for the streaming server?
      - 1000 CU at the same time, what about RAM for the streaming server?
      4. What parameters that I can tune for the streaming server?
      5. CPU is OK for this server if the system have more than 1000 CU at the same time?

      Please give me your advices about issues above.

      Thanks in advances.

      Tran Anh Dung.
    1. rrlanham -

      There is a detailed performance tuning guide here

      Java allocates memory as set by java heap size, so it might appear that more memory is allocated per connection. Use JConsole to connect to Wowza for a better view memory.