Skip to content

Instantly share code, notes, and snippets.

@haydenmc
Created February 23, 2021 09:23
Show Gist options
  • Save haydenmc/491e870b46966348e59857830e50b4da to your computer and use it in GitHub Desktop.
Save haydenmc/491e870b46966348e59857830e50b4da to your computer and use it in GitHub Desktop.
Spins up a bunch of ftl_app instances for rudimentary FTL load testing
<#
Fires up a bunch of ftl_app instances pointing at an ingest
#>
[CmdletBinding()]
param (
[Parameter(Mandatory = $true)]
[string]
$FtlAppPath,
[Parameter(Mandatory = $true)]
[string]
$JanusHostname,
[Parameter(Mandatory = $true)]
[string]
$HmacKey,
[Parameter(Mandatory = $true)]
[string]
$H264FilePath,
[Parameter(Mandatory = $true)]
[string]
$OpusFilePath,
[Parameter()]
[int]
$StartChannelId = 1,
[Parameter()]
[int]
$EndChannelId = 10
)
if (!(Test-Path -Path $FtlAppPath -PathType Leaf))
{
throw "FTL app executable not found at '$FtlAppPath'.";
}
if (!(Test-Path -Path $H264FilePath -PathType Leaf))
{
throw "H264 file '$H264FilePath' not found.";
}
if (!(Test-Path -Path $OpusFilePath -PathType Leaf))
{
throw "Opus file '$OpusFilePath' not found."
}
$processes = @()
for ($i = $StartChannelId; $i -le $EndChannelId; ++$i)
{
$process = Start-Process -FilePath $FtlAppPath -PassThru -ArgumentList `
@(
"-i", $JanusHostname,
"-s", "$i-$HmacKey",
"-v", $H264FilePath,
"-a", $OpusFilePath
)
$processes += $process
Write-Host "Started process for channel $i"
Start-Sleep -Milliseconds 500
}
Read-Host "Press ENTER to stop"
foreach ($p in $processes)
{
try
{
$p.Kill()
$p.Close()
}
catch {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment