Skip to content

Load testing using another server

Configuring an Ubuntu server

  1. Install Xvfb, Xorg to work with a virtual output device

    apt-get install xvfb -y
    apt-get install x11-xkb-utils xfonts-100dpi xfonts-75dpi xfonts-scalable xfonts-cyrillic  xserver-xorg-core  xserver-xorg-video-dummy alsa-base -y
    

  2. Install a dummy sound card (this step may be skipped in Ubuntu 20.04 and newer)

    apt-get install linux-image-extra-4.4.0-62-generic -y
    modprobe snd-dummy
    

  3. Configure a virtual video device: edit the configuration file /usr/share/X11/xorg.conf.d/xorg.conf

    Section "Device"
        Identifier  "Configured Video Device"
        Driver      "dummy"
        Option "ConstantDPI" "true"
        VideoRam 192000
    EndSection
    
    Section "Monitor"
        Identifier  "Configured Monitor"
        HorizSync 31.5-48.5
        VertRefresh 50-70
        Modeline "1600x1200" 22.04 1600 1632 1712 1744 1200 1229 1231 1261
        Modeline "1600x900" 33.92 1600 1632 1760 1792 900 921 924 946
        Modeline "1440x900" 30.66 1440 1472 1584 1616 900 921 924 946
        ModeLine "1366x768" 72.00 1366 1414 1446 1494  768 771 777 803
        Modeline "1280x1024" 31.50 1280 1312 1424 1456 1024 1048 1052 1076
        Modeline "1280x800" 24.15 1280 1312 1400 1432 800 819 822 841
        Modeline "1280x768" 23.11 1280 1312 1392 1424 768 786 789 807
        Modeline "1360x768" 24.49 1360 1392 1480 1512 768 786 789 807
        Modeline "1024x768" 18.71 1024 1056 1120 1152 768 786 789 807
        Modeline "768x1024" 19.50 768 800 872 904 1024 1048 1052 1076
    EndSection
    
    Section "Screen"
        Identifier  "Default Screen"
        Monitor     "Configured Monitor"
        Device      "Configured Video Device"
        DefaultDepth 24
        SubSection "Display"
            Depth 24
            Modes "1600x1200" "1680x1050" "1600x900" "1400x1050" "1440x900" "1280x1024" "1366x768" "1280x800" "1024x768"
        EndSubSection
    EndSection
    
    Section "ServerFlags"
        Option "MaxClients" "2048"
    EndSection
    

  4. Install Apache and set up SSL, if you plan to place a player test page on the same server

    apt-get install apache2
    

  5. Install Chrome

    wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
    echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list
    apt-get update
    apt-get install google-chrome-stable
    

Scripts for load testing

A gzip file with scripts to perform load testing can be downloaded here.

The archive contains

  • the player directory containing Web player scripts
  • start_xorg.sh - the script to start Xorg
  • loadtest.sh - the script to start tests

Scripts of the player must be available from the Apache HTML directory: place the player directory to /var/www/html/tests/player, for example. The player.html test page accepts parameters. For example:

http://<server IP>/tests/player/player.html?streamName=test&autoplay=true

The following parameters are supported

  • stream name: streamName=test
  • autoplay: autoplay=true
  • resolution: resolution=640x480 (in this case, transcoding will be enabled on WCS server, that inscreases server CPU load)
  • media playback technology: mediaProvider=WebRTC,MSE

You can also use Embed Player page directly from WCS server to test:

https://wcs:8888/embed_player?urlServer=wss://wcs:8443&streamName=test&mediaProviders=WebRTC&autoplay=true

The loadtest.sh script can accept the following parameters:

mandatory:

  • url - the URL of the player page with all parameters or
  • urlsfile - the path to a file that contains multiple such URL that will be used one by one

optional:

  • stressrate - time interval of adding a new subscriber, in milliseconds
  • ttl - lifetime of a subscriber in seconds
  • maxsubscribers - maximum number of subscribers

Running tests

  1. Start Xorg

    ./start_xorg.sh
    

  2. Increase a maximum opened files system limit

    ulimit -n 1000000
    

  3. Start loadtest.sh with chosen parameters
    For example,

    ./loadtest.sh -url https://wcs:8888/embed_player?urlServer=wss://wcs:8443&streamName=test&mediaProviders=WebRTC&autoplay=true -maxsubscribers 50 -stressrate 1000 -ttl=300
    
    or
    ./loadtest.sh -urlsfile urls.txt -stressrate 1000 -ttl 300 -maxsubscribers 50