-
Stéphane Diemer authoredStéphane Diemer authored
Benchmarking
This documentation explains how to benchmark a MediaServer to get the maximum viewers that can be handled. The benchmarking tool is based on Locust.
Prerequisite
- Envsetup and ansible Help to get envsetup.
- An SSH access to the machines that will be used to make requests on MediaServer (you can use the workers for that).
- A media to test. You can create an empty live stream for the test. If you use a live page, you will have to set the status of the live to "ongoing".
Note that the machines used by the benchmarker must have an access to UbiCast packages (to get the ubicast-benchmark
package).
Inventory
Create a new inventory with following configuration.
Hosts file
This file should be located in <your inventory>/hosts
.
[bench_server]
worker1.test.com
[bench_worker]
worker2.test.com
The system targetted with bench_server
will host the Locust server. This system must be unique.
The systems targetted with bench_worker
will host the Locust workers. Multiple workers can be used.
Group vars
This file should be located in <your inventory>/group_vars/all.yml
.
bench_host: <MediaServer URL. Example: "msauto.ubicast.net">
bench_oid: <Media OID. Example: "l125f58fbb8c655nth76">
bench_user: <MediaServer account username. Can be empty if the media access is not protected. Example: "test">
bench_password: <MediaServer account password. Can be empty if the media access is not protected. Example: "pwd">
bench_host_api_key: <MediaServer master API key>
Install the benchmarker
# ansible-playbook -i inventories/<your inventory> playbooks/bench.yml
This playbook will install everything you need : locust server, locust workers, and benchmarker.
Start the benchmarker
Disable anti-ddos in MediaServer Nginx configuration (usually in /etc/nginx/conf.d/limits.conf
).
If the server hosting the bench server is using a firewall, disable it to be able to access the locust interface. For example, if ferm
is installed: systemctl ferm stop
.
Launch the test stream on the bench server, using the docker container :
cd /usr/share/ms-testing-suite && make run_live
Or directly by hand:
/usr/share/ms-testing-suite/ms_live_streamer.py /etc/mediaserver/bench-streaming.conf
Go with your browser on http://<bench_server>:8089
. You might have to use an SSH tunnel to access this port.
Set the number of viewers and the hatch rate (usually the hatch rate is 10% of the viewers count) and start the bench.
Watch for /var/log/access.log
(warning: this file is buffered by default, you can disable buffer in nginx.conf
).
Restart Locust server & workers
If you need to restart both server & workers, you can launch the playbook with the tag prepare-bench
:
# ansible-playbook -i inventories/<your inventory> playbooks/bench.yml -t prepare-bench
/!\ EXPERIMENTAL : Elasticsearch + Kibana + metricbeat
Kibana + metricbeat allows you to monitor and display statistics about the infrastructure. This feature is experimental.
First you need to add a new group to your hosts files :
[elastic]
elastic1.test.com
Then launch the playbook bench-monitoring
which will install both the elastic suite on the elastic host, and metricbeat on mediaserver & postgres servers.
# ansible-playbook -i inventories/<your inventory> playbooks/bench-monitoring.yml
Your kibana instance will be accessible at http://elastic1.test.com:5601