openvidu-test-load folder removed (moved to repo OpenVidu/openvidu-loadtest)

pull/154/head
pabloFuente 2018-10-29 14:49:55 +01:00
parent 312445d91d
commit e4dd807898
6 changed files with 0 additions and 8356 deletions

View File

@ -1,26 +0,0 @@
# OpenVidu Test Load
This repository aims to facilitate the definition, execution and review of massive load testing scenarios of an OpenVidu application in a distributed cluster of containerized browsers, located in Amazon Web Services Cloud.
Number of total sessions and participants must be customizable. Test will have the following default conditions:
- Every participant will be connecting from a single browser. Eveyr browser will be launched in its own Docker container with fixed resource configuration (available RAM, number of cores and bandwidth)
- Every browser will be a Chrome instance launched with the following options: `allow-file-access-from-files`, `use-file-for-fake-video-capture=fakevideo.y4m`, `use-file-for-fake-audio-capture=fakeaudio.wav`, `window-size=1980,1280`
- OpenVidu will be deployed in a dedicated EC2 machine. Every OpenVidu session (and therefore every dockerized browser) will be connecting to this same instance
- Each session will have 7 participants (7 publishers and 42 subscribers)
- Each video will have a resolution of 540×360 pixels, 30 fps
- Each browser will be responsible of obtaining the necessary token to connect to its specific test session (URL will contain as parameters the secret, the session identifier and the ip where to perform REST operations, so the JavaScript code can get the token)
- Any kind of complexity in the client code will be avoided: just HTML videos displaying the local and remote streams
- Every RTCPeerConnection object will be exposed to gather statistics thanks to method getStats()
- The following statistics will be the ones gathered for each RTCPeerConnection object: Sender Round-Trip-Time (googRtt), Receviers Round-Trip-Time (googRtt), Received Bit-Rate, Sent Bit-Rate, Packet loss
- Every browser will be monitored to ensure each one of the 7 videos is playing media
The testing process for every client node will be:
1. Launch Chrome with the required flags (selenium code in the test orchestrator will launch every client node)
2. Wait fot the testing web application to load. This static web app will be hosted in the same EC22 machine as OpenVidu Server. RECORD TIME
3. Wait for the browser to connect to the session in OpenVidu Server (`connectionCreated` event). RECORD TIME
4. Wait for the local video to be playing (`videoPlaying` event). RECORD TIME
5. Wait for each one of the 6 remote videos to be playing (`videoPlaying` event). RECORD TIME
6. Gather statistics. Each call to getStats over each RTCPeerConnection object (7 calls to getStats in total) will take place every second, n times (n=8 by default)
7. Close browser

View File

@ -1,220 +0,0 @@
var OPENVIDU_SERVER_URL;
var OPENVIDU_SERVER_SECRET;
var SESSION_ID;
var USER_ID;
var OV;
var session;
var rtcPeerConnectionStats = {};
window.onload = () => {
var url = new URL(window.location.href);
OPENVIDU_SERVER_URL = url.searchParams.get("publicurl");
OPENVIDU_SERVER_SECRET = url.searchParams.get("secret");
SESSION_ID = url.searchParams.get("sessionId");
USER_ID = url.searchParams.get("userId");
if (!OPENVIDU_SERVER_URL || !OPENVIDU_SERVER_SECRET || !SESSION_ID || !USER_ID) {
initFormValues();
document.getElementById('join-form').style.display = 'block';
} else {
joinSession();
}
};
function joinSession() {
OV = new OpenVidu();
session = OV.initSession();
session.on("streamCreated", event => {
var subscriber = session.subscribe(event.stream, insertVideoContainer(event));
subscriber.on('videoPlaying', e => {
var userId = event.stream.connection.data;
gatherStats(event.stream.getRTCPeerConnection(), userId);
rtcPeerConnectionStats[userId] = {
interval: window.setInterval(
() => {
gatherStats(event.stream.getRTCPeerConnection(), userId);
}, 1000)
}
});
});
session.on("streamDestroyed", event => {
var userId = event.stream.connection.data;
window.clearInterval(rtcPeerConnectionStats[userId].interval);
delete rtcPeerConnectionStats[userId];
document.getElementById('video-' + userId).outerHTML = "";
});
getToken().then(token => {
session.connect(token, USER_ID)
.then(() => {
var publisher = OV.initPublisher('local', { resolution: "540x320", frameRate: 30 });
session.publish(publisher);
})
.catch(error => {
console.log("There was an error connecting to the session:", error.code, error.message);
});
});
}
function leaveSession() {
session.disconnect();
}
window.onbeforeunload = () => {
if (session) leaveSession();
};
function insertVideoContainer(event) {
var commonTagStyle = "background-color: #0088aa; color: white; font-size: 13px; font-weight: bold; padding: 1px 3px; border-radius: 3px; font-family: 'Arial'";
var videoContainer = document.createElement('div');
videoContainer.id = 'video-' + event.stream.connection.data;
videoContainer.setAttribute("style", "display: inline-block; margin: 5px 5px 0 0");
var infoContainer = document.createElement('div');
infoContainer.setAttribute("style", "display: flex; justify-content: space-between; margin-bottom: 3px");
var userId = document.createElement('div');
userId.setAttribute("style", commonTagStyle);
userId.innerText = event.stream.connection.data;
var resolution = document.createElement('div');
resolution.id = 'resolution-' + event.stream.connection.data;
resolution.setAttribute("style", "display: inline-block; " + commonTagStyle);
resolution.innerText = event.stream.videoDimensions.width + 'x' + event.stream.videoDimensions.height;
var rtt = document.createElement('div');
rtt.id = 'rtt-' + event.stream.connection.data;
rtt.setAttribute("style", "display: inline-block; " + commonTagStyle);
var delayMs = document.createElement('div');
delayMs.id = 'delay-' + event.stream.connection.data;
delayMs.setAttribute("style", "display: inline-block; " + commonTagStyle);
var jitter = document.createElement('div');
jitter.id = 'jitter-' + event.stream.connection.data;
jitter.setAttribute("style", "display: inline-block; " + commonTagStyle);
var receiveBandwidth = document.createElement('div');
receiveBandwidth.id = 'receive-bandwidth-' + event.stream.connection.data;
receiveBandwidth.setAttribute("style", "display: inline-block; " + commonTagStyle);
var bitrate = document.createElement('div');
bitrate.id = 'bitrate-' + event.stream.connection.data;
bitrate.setAttribute("style", commonTagStyle);
infoContainer.appendChild(userId);
infoContainer.appendChild(resolution);
infoContainer.appendChild(rtt);
infoContainer.appendChild(delayMs);
infoContainer.appendChild(jitter);
infoContainer.appendChild(receiveBandwidth);
infoContainer.appendChild(jitter);
infoContainer.appendChild(bitrate);
videoContainer.appendChild(infoContainer);
document.body.appendChild(videoContainer);
return videoContainer;
}
function initFormValues() {
document.getElementById("form-publicurl").value = OPENVIDU_SERVER_URL;
document.getElementById("form-secret").value = OPENVIDU_SERVER_SECRET;
document.getElementById("form-sessionId").value = SESSION_ID;
document.getElementById("form-userId").value = USER_ID;
}
function joinWithForm() {
OPENVIDU_SERVER_URL = document.getElementById("form-publicurl").value;
OPENVIDU_SERVER_SECRET = document.getElementById("form-secret").value;
SESSION_ID = document.getElementById("form-sessionId").value;
USER_ID = document.getElementById("form-userId").value;
document.getElementById('join-form').style.display = 'none';
joinSession();
return false;
}
function getToken() {
return createSession().then(sessionId => createToken(sessionId));
}
function createSession() { // See https://openvidu.io/docs/reference-docs/REST-API/#post-apisessions
return new Promise((resolve, reject) => {
var request = new XMLHttpRequest();
request.open("POST", OPENVIDU_SERVER_URL + "api/sessions", true);
request.setRequestHeader('Content-Type', 'application/json');
request.setRequestHeader('Authorization', "Basic " + btoa("OPENVIDUAPP:" + OPENVIDU_SERVER_SECRET));
request.onreadystatechange = () => {
if (request.readyState === 4) {
if (request.status === 200 || request.status === 409) {
resolve(SESSION_ID);
} else {
console.warn('No connection to OpenVidu Server. This may be a certificate error at ' + OPENVIDU_SERVER_URL);
if (window.confirm('No connection to OpenVidu Server. This may be a certificate error at \"' + OPENVIDU_SERVER_URL + '\"\n\nClick OK to navigate and accept it. ' +
'If no certificate warning is shown, then check that your OpenVidu Server is up and running at "' + OPENVIDU_SERVER_URL + '"')) {
location.assign(OPENVIDU_SERVER_URL + '/accept-certificate');
}
}
};
}
request.send(JSON.stringify({ customSessionId: SESSION_ID }));
});
}
function createToken() { // See https://openvidu.io/docs/reference-docs/REST-API/#post-apitokens
return new Promise((resolve, reject) => {
var request = new XMLHttpRequest();
request.open("POST", OPENVIDU_SERVER_URL + "api/tokens", true);
request.setRequestHeader('Content-Type', 'application/json');
request.setRequestHeader('Authorization', "Basic " + btoa("OPENVIDUAPP:" + OPENVIDU_SERVER_SECRET));
request.onreadystatechange = () => {
if (request.readyState === 4) {
if (request.status == 200) {
resolve(JSON.parse(request.response).token);
} else {
reject(new Error(request.responseText))
}
};
}
request.send(JSON.stringify({ session: SESSION_ID }));
});
}
function gatherStats(rtcPeerConnection, userId, errorCallback) {
return rtcPeerConnection.getStats(response => {
const fullReport = [];
response.result().forEach(report => {
const stat = {
id: report.id,
timestamp: report.timestamp,
type: report.type
};
report.names().forEach((name) => {
stat[name] = report.stat(name);
});
fullReport.push(stat);
});
var activeCandidateStats = fullReport.find(report => report.type === 'googCandidatePair' && report.googActiveConnection === 'true');
if (!!activeCandidateStats) {
rtcPeerConnectionStats[userId].rtt = activeCandidateStats.googRtt;
rtcPeerConnectionStats[userId].transport = activeCandidateStats.googTransportType;
rtcPeerConnectionStats[userId].candidateType = activeCandidateStats.googRemoteCandidateType;
rtcPeerConnectionStats[userId].localAddress = activeCandidateStats.googLocalAddress;
rtcPeerConnectionStats[userId].remoteAddress = activeCandidateStats.googRemoteAddress;
document.querySelector('#rtt-' + userId).innerText = 'RTT: ' + rtcPeerConnectionStats[userId].rtt + ' ms';
}
var videoBwe = fullReport.find(report => report.type === 'VideoBwe');
if (!!videoBwe) {
rtcPeerConnectionStats[userId].availableSendBandwidth = Math.floor(videoBwe.googAvailableSendBandwidth / 1024);
rtcPeerConnectionStats[userId].availableReceiveBandwidth = Math.floor(videoBwe.googAvailableReceiveBandwidth / 1024);
}
var videoStats = fullReport.find(report => report.type === 'ssrc' && report.mediaType === 'video');
if (!!videoStats) {
rtcPeerConnectionStats[userId].bitRate = (videoStats.bytesReceived - rtcPeerConnectionStats[userId].bytesReceived) * 8 / 1024;
rtcPeerConnectionStats[userId].jitter = videoStats.googJitterBufferMs;
rtcPeerConnectionStats[userId].bytesReceived = videoStats.bytesReceived;
rtcPeerConnectionStats[userId].delay = videoStats.googCurrentDelayMs;
rtcPeerConnectionStats[userId].packetsLost = videoStats.packetsLost;
document.querySelector('#delay-' + userId).innerText = 'Delay: ' + rtcPeerConnectionStats[userId].delay + ' ms';
document.querySelector('#jitter-' + userId).innerText = 'jitter: ' + rtcPeerConnectionStats[userId].jitter;
document.querySelector('#receive-bandwidth-' + userId).innerText = 'Bandwidth: ' + rtcPeerConnectionStats[userId].availableReceiveBandwidth + ' kbps';
document.querySelector('#bitrate-' + userId).innerText = Math.floor(rtcPeerConnectionStats[userId].bitRate) + ' kbps';
}
console.log(rtcPeerConnectionStats);
}, null, errorCallback);
}

View File

@ -1,20 +0,0 @@
-----BEGIN CERTIFICATE-----
MIIDUTCCAjmgAwIBAgIJAOakq4gNcqYkMA0GCSqGSIb3DQEBCwUAMD8xFjAUBgNV
BAMMDXd3dy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m8hgPpJQ==
-----END CERTIFICATE-----

View File

@ -1,23 +0,0 @@
<html>
<head>
<title>openvidu-hello-world</title>
<link rel="shortcut icon" href="resources/images/favicon.ico" type="image/x-icon">
<script src="openvidu-browser-2.5.0.js"></script>
<script src="app.js"></script>
</head>
<body>
<div id="join-form" style="display: none">
<form onsubmit="return joinWithForm()">
<input id="form-publicurl" type="text" name="publicurl" placeholder="OpenVidu ip" required>
<input id="form-secret" type="text" name="secret" placeholder="OpenVidu secret" required>
<input id="form-sessionId" type="text" name="sessionId" placeholder="sessionId" required>
<input id="form-userId" type="text" name="userId" placeholder="userId" required>
<input type="submit" value="Join session">
</form>
</div>
<div id="local" style="display: inline-block"></div>
</body>
</html>

View File

@ -1,28 +0,0 @@
-----BEGIN PRIVATE KEY-----
MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCuua7yj4SbkUZ8
pcSRWYCqlLA5F4IsXLjiTgvQXpVa1jQ3z3hDHGCNVOTsVrDHZkldcJ6P1l6NSyYd
r2XaMt8FnsDkcNYlXRBUYktQkpH3IxqD7Qbvemtxtl3xo/PG4nP1kNbv0r4q+YwN
0pRyjMssD2TEGlYLJSueCL8wmSTxa0vBjCU/1CTVsW/AL90CIQtuwpmHI8dIDO2c
a0LgryC1O3CaPZ56y7dd9iQlfHvT3VZ+MtlPuM8fDKCLIKrr95tNSvtDNE0ay8eZ
qyWF9kZhaIeXnqGFkNzAJ47uqwn04RB9CNOW+eDWguGaAelmI0ZKjrUnM6TnGMtz
ZtKHucTpAgMBAAECggEAaAg850WWkj3sdxkIMfbVijtftY6OvjUzC+OmWxmF2gEC
NFy+YU8LGft7FlEDjqYTdqQwdLoRsBUXi8M8ZK+3ZJRCi4G3r6V6rJOd/kpWyIxJ
JFXDtGDyilEoHFEfO8LngkYMA905x0KwJibEpnO4IPLFb5Gyu44VK1JP6/KzMV5R
cq/ZxKsamWOurvODNNTEzeV9l+lyaPLlE2ki2ob9wn6B1u1xAyXBRV8iVSqulOu5
oO+WSzNEORCO4YJaPiknW1PMEf92dd8NiFFjzT9pjZ/q7ix9y6o4y1I/9COdLD1K
BlnO39eLydVy8i84F9eCJbyfJBAXJsJfYaoFybgwEQKBgQDnJ9KFhE4rv8GpgYav
x2rE4eIiQ9qBvJ+l6LTJFsL0TmIBsBliVjZyASbFEbtK2JdOqdRb1ko5FOaqI/c9
zibyMxob2Rl1HR3RtFj/dZQ7EIgwWC6J8vKBMicpDIL41luYYvqiuLg0o1cC4pFo
/eitCkhErM3h0JHi5YB8X847xQKBgQDBgTMhGNQe6SOineEyQ/7RdZ4fRsGpnfID
bJTqrBEAqnKdIzXI7Bx5mNLPoohA+OWIu97aTR5DI1r98M0RcuWBs/MxtivRyE5R
YWh0Lt5ZP6o0tl13gcVbcjed0qZw6umzJjaYkR1WCZUVUpUuDvfpF3NDEWMzuIlt
P4ZHwCiC1QKBgDZJHOCsTKtrkjCbsaTQYVuxbKj9ZHB5esi82NAs30X+rneVArEc
bBbj/FXlryWJricULUIQFkhHh1BHuAW0x2Kz65rEpnzhhKI+B3SfCVvBqyonW26c
NqVuwNGcFZoYxVQJUrEqTmBWR9XunZWZo64XrxcpugQhNlGh8kXDPiy9AoGADlZ8
a19jmEa+FTaNkSPopayJYtfjUaYaYJaTEjBdsibvByWsvo6ALaJdPHVWkzneCBuj
j5lXPLJJ87b7+ucAinPC+VP+OzUUWINXMgSnBQXqnq1Ej65V6Ui1RkRtgMBnQJb8
RKG8ArwDB+lulFMXm3XZXIbVSufJhwbF9FsQpWECgYA7JX738xOkgN7J5V7s6YKW
JIaPnW6dzpgQOsSRTsqVx2L5kYJc9dhwsaJLHI1SlE2y0NIo7y0IxtHHKmu8bWwo
6MXO6hSFTK6M+hCPoScHbgYF+mYxeYG4261wikq66POMSknfXLZYVYoGVk1o08Li
pqLqj7cen6NOM8mxRibX/Q==
-----END PRIVATE KEY-----

File diff suppressed because one or more lines are too long