Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Server default settings are mostly universal and need to be tuned to certain client case.

Server load and memory consumption optimization

Garbage collector tuning

Garbage collector (GC) is an important part of Java VM. When GC is running, it dramatically increases the server load and may stop another tasks execution, therefore it is recommended to minimize GC launch with the following settings in wcs-core.properties file

Code Block
languagebash
themeRDark
#Disable heuristic rules
-XX:+UseCMSInitiatingOccupancyOnly

#Reduce Old Gen threshold
-XX:CMSInitiatingOccupancyFraction=70

# Use System.gc() concurrently in CMS
-XX:+ExplicitGCInvokesConcurrent

# Disable System.gc() for RMI, for 10000 hours
-Dsun.rmi.dgc.client.gcInterval=36000000000
-Dsun.rmi.dgc.server.gcInterval=36000000000

Heap memory tuning

Many objects with data are created and destroyed in memory while streaming. Therefore it is recommended to allocate at least 1/2 of server physical memory for Java memory heap. For example, if server RAM is 32 Gb, then it is recommended to allocate 16 Gb with the following settings in wcs-core.properties file

...

Code Block
languagebash
themeRDark
disable_manager_rmi=true

REST client tuning

When REST hooks are used, on every WCS server action (establishing client connection, publishing and playing a stream, making a SIP call etc) HTTP REST connection to backend server is established. With a large number of simultaneously publishing clients or subscribers, with the default WCS settings it is possible to exhaust the WCS REST client thread pool, that is lead to deadlocks. Then, server stops to publish and play streams.

...

Code Block
languagebash
themeRDark
disable_rest_requests=true

Excessive logging supression

When REST hooks are used, REST client operations, EchoApp default backend operations and REST API server operations are written to WCS core logs. That leads to large number of entries in the log file and, therefore, inceases the server load. The excessive logging may be decreased if necessary using the following parameters in log4j.properties file:

Code Block
languagebash
themeRDark
log4j.logger.RestClient=WARN
log4j.logger.EchoApp=WARN
log4j.logger.RestApiRouter=WARN

UDP tuning

Streaming mediadata are transferred with UDP packets. Those packets can be dropped, for example if server does not have enough time to parse packet queue, that leads to picture quality loss and freezes. To escape this it is necessary to tune UDP sockets buffers with the following settings in flashphoner.properties file

...

Code Block
languagebash
themeRDark
sysctl -w net.ipv4.ip_local_port_range="59999 63000"

Adjusting the maximum number of opened files

In the launch script webcallserver that is in subfolder bin in WCS home folder, for example

Code Block
languagebash
themeRDark
/usr/local/FlashphonerWebCallServer/bin/webcallserver

in start() function the maximum number of opened files is set

Code Block
languagebash
themeRDark
function start() {
 ...
 echo -n $"$PRODUCT: starting"

 ulimit -n 20000    
 if [[ "$1" == "standalone" ]]; then
     ...
 fi
 ...
}

By default, this value is set to 20000, but it may be increased if necessary, following the limitations of the operating system used.