Performance Testing [schedule][main] - 35.163.142.7/500ms delay #133
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: PerformanceTests | |
env: | |
SERVER_ADDRESS: ${{ inputs.server_private_address || '172.31.38.198' }} | |
LISTEN_ADDRESS: 127.0.0.1 | |
SERVER_PUBLIC_ADDRESS: ${{ inputs.server_public_address || '35.163.142.7' }} | |
CLIENT_LISTEN_ADDRESS: ${{ inputs.client_listen_address || '172.31.21.30' }} | |
SERVER_WAIT_TIMEOUT: ${{ inputs.server_wait_timeout || 150 }} | |
CONNECT_DELAY_MS: ${{ inputs.connect_delay_ms || 100 }} | |
CONNECT_DELAY_DEVICE: ${{ inputs.connect_delay_device || 'eth0' }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }} | |
AWS_INSTANCE_ID: ${{ secrets.AWS_INSTANCE_ID }} | |
on: | |
schedule: | |
- cron: '1 1 * * *' | |
workflow_dispatch: | |
inputs: | |
server_public_address: | |
description: 'public address for the server' | |
type: string | |
default: 35.163.142.7 | |
required: true | |
server_private_address: | |
description: 'private address for the server' | |
type: string | |
default: 172.31.38.198 | |
required: true | |
client_listen_address: | |
description: 'private address for the client to listen on' | |
type: string | |
default: 172.31.21.30 | |
required: true | |
server_wait_timeout: | |
description: 'Server global timeout for tests' | |
type: integer | |
default: 150 | |
required: false | |
connect_delay_ms: | |
description: 'connection delay in milliseconds set on the server' | |
type: integer | |
default: 0 | |
required: true | |
connect_delay_device: | |
description: 'serverside network device to set delay on' | |
type: string | |
default: eth0 | |
required: true | |
keep_aws_running: | |
description: 'keeps aws vm running for subsequent runs' | |
type: boolean | |
default: false | |
required: true | |
run-name: Performance Testing [${{ github.event_name }}][${{ github.head_ref || github.ref_name }}] - ${{ inputs.server_public_address || '35.163.142.7' }}/${{ inputs.connect_delay_ms || '500' }}ms delay | |
jobs: | |
launch-aws-vm: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install AWS cli | |
id: install-aws-cli | |
uses: unfor19/install-aws-cli-action@master | |
with: | |
version: "2" | |
- run: | | |
aws --version | |
# run the instance | |
aws ec2 start-instances --instance-ids ${{ secrets.AWS_INSTANCE_ID }} | |
shell: bash | |
- run: | | |
# assure that the instance is stopped on error | |
aws ec2 stop-instances --instance-ids ${{ secrets.AWS_INSTANCE_ID }} | |
shell: bash | |
if: ${{ failure() && ! inputs.keep_aws_running }} | |
stop-aws-vm: | |
runs-on: ubuntu-latest | |
needs: run-client | |
if: ${{ always() && ! inputs.keep_aws_running }} | |
steps: | |
- name: Install AWS cli | |
id: install-aws-cli | |
uses: unfor19/install-aws-cli-action@master | |
with: | |
version: "2" | |
- run: | | |
# assure that the instance is stopped even on error | |
aws ec2 stop-instances --instance-ids ${{ secrets.AWS_INSTANCE_ID }} | |
shell: bash | |
run-client: | |
runs-on: vm-client | |
needs: launch-aws-vm | |
strategy: | |
matrix: | |
download_size: [ 100, 10, 1 ] | |
connections_number: [ 4, 1 ] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
clean: true | |
ref: ${{ github.head_ref || github.ref_name }} | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.18.10 | |
- name: Set up MinGW | |
uses: egor-tensin/setup-mingw@v2 | |
with: | |
platform: x64 | |
static: false | |
version: 8.1.0 | |
- name: Prepare | |
shell: powershell | |
run: | | |
New-Item -Path . -Name "build" -ItemType "directory" -Force | |
New-Item -Path . -Name "build/config" -ItemType "directory" -Force | |
$config = Get-Content -Path ./docker/client-env/qpep.yml.tpl | |
$config = $config.replace('<QPEP_GATEWAY>',$env:SERVER_PUBLIC_ADDRESS) | |
$config = $config.replace('<QPEP_ADDRESS>',$env:CLIENT_LISTEN_ADDRESS) | |
$config > ./build/config/qpep.yml | |
Copy-Item "./windivert/x64/*" -Destination "./build" | |
- name: Prepare tests reporting | |
run: | | |
go install github.com/jstemmer/[email protected] | |
- name: Build Client | |
shell: cmd | |
run: | | |
set CGO_ENABLED=1 | |
set GOOS=windows | |
set GOHOSTARCH=amd64 | |
set GOHOSTOS=windows | |
go build -v -o build/qpep.exe | |
- name: Run Client | |
shell: powershell | |
run: | | |
cd build/ | |
Start-Process qpep.exe -Wait -ArgumentList ("/client /service install") | |
Start-Process qpep.exe -Wait -ArgumentList ("/client /service start") | |
Start-Sleep -Seconds 5 | |
- name: Wait Server | |
shell: powershell | |
run: | | |
$Stoploop = $false | |
[ int ]$Retrycount = "60" | |
do { | |
try { | |
Write-Host "Echoing server..." | |
Invoke-WebRequest -Uri "http://${{ env.SERVER_PUBLIC_ADDRESS }}:444/api/v1/server/status" -UseBasicParsing -TimeoutSec 2 | |
Write-Host "Job completed" | |
$Stoploop = $true | |
} | |
catch { | |
$Retrycount = $Retrycount - 1 | |
if ($Retrycount -gt 0){ | |
Start-Sleep -Seconds 2 | |
} | |
else { | |
Write-Error "Could not get server after 20 retries." -ErrorAction Stop | |
} | |
} | |
} | |
While ($Stoploop -eq $false) | |
- name: Run Tests | |
shell: cmd | |
run: | | |
cd docker/speedtests/ | |
go test speed_test.go -v -c -o speedtests.test | |
.\speedtests.test -target_url http://${{ env.SERVER_PUBLIC_ADDRESS }}:8080/target_${{ matrix.download_size }}M.dat ^ | |
-expect_mb ${{ matrix.download_size }} -connections_num ${{ matrix.connections_number }} ^ | |
-test.v -test.timeout 5m > speedtests.out | |
go run utils/plotter.go output.csv "Client speed test [Delay:${{ env.CONNECT_DELAY_MS }}ms][TargetSize:${{ matrix.download_size }}M][Connections:${{ matrix.connections_number }}]" | |
- name: Stop Client | |
if: always() | |
shell: powershell | |
run: | | |
cd build/ | |
Start-Process qpep.exe -Wait -ArgumentList ("/client /service stop") | |
Start-Process qpep.exe -Wait -ArgumentList ("/client /service uninstall") | |
Start-Sleep -Seconds 5 | |
try { | |
Get-Process qpep | Stop-Process | |
} | |
catch | |
{ } | |
- name: Reset Proxy | |
if: always() | |
run: | | |
go run docker/speedtests/utils/reset_proxy_util.go | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: client_${{ env.CONNECT_DELAY_MS }}ms_${{ matrix.download_size }}MB_${{ matrix.connections_number }}conn | |
path: | | |
${{ github.workspace }}/docker/speedtests/output.csv | |
${{ github.workspace }}/docker/speedtests/speedtests.out | |
${{ github.workspace }}/docker/speedtests/speedtests.log | |
${{ github.workspace }}/build/*.log | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: graph_client_${{ env.CONNECT_DELAY_MS }}ms_${{ matrix.download_size }}MB_${{ matrix.connections_number }}conn | |
path: | | |
${{ github.workspace }}/docker/speedtests/data.png | |
- name: Auto-cancel workflow on error | |
if: failure() | |
uses: andymckay/[email protected] | |
run-server: | |
runs-on: vm-server | |
needs: launch-aws-vm | |
steps: | |
- name: Pre-Cleanup | |
run: | | |
sudo rm -rf docker/server-data-env/output/* || true | |
- uses: actions/checkout@v3 | |
with: | |
clean: true | |
ref: ${{ github.head_ref || github.ref_name }} | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.18.10 | |
- name: Build Server | |
env: | |
QPEP_BRANCH: ${{ github.head_ref || github.ref_name }} | |
run: | | |
docker version | |
cd docker/ | |
pushd build-linux/ | |
docker build --no-cache -t project-faster/qpep_server . | |
- name: Run data server | |
run: | | |
cd docker/server-data-env/ | |
pushd http-data/ | |
bash gen-local-data.sh | |
popd | |
docker compose up -d | |
- name: Run Server | |
run: | | |
cd docker/server-env/ | |
docker compose up -d | |
- name: Reset connection delay | |
run: | | |
sudo bash ${{ github.workspace }}/.github/workflows/set_delay_port.sh -d | |
- name: Set connection delay | |
if: inputs.connect_delay_device > 0 | |
run: | | |
sudo bash ${{ github.workspace }}/.github/workflows/set_delay_port.sh "${{ env.CONNECT_DELAY_MS }}" "${{ env.CONNECT_DELAY_DEVICE }}" | |
- name: Wait Tests | |
timeout-minutes: 60 # max allowed timeouts | |
run: | | |
# initial wait for server setup | |
sleep 60 | |
echo [Starting wait for tests execution...] | |
CONN_NUM=1 | |
RETRIES=${{ env.SERVER_WAIT_TIMEOUT }} | |
while ! (( RETRIES <= 0 )); | |
do | |
CONN_NUM=$(curl -s -XGET -H 'Accept:application/json' http://127.0.0.1:444/api/v1/server/echo | jq .total_connections || true) | |
echo "Connections alive: $CONN_NUM" | |
if (( CONN_NUM <= 0 )); then | |
(( RETRIES -= 1 )) || true | |
echo "Remaining $RETRIES retries" | |
else | |
(( RETRIES=${{ env.SERVER_WAIT_TIMEOUT }} )) || true | |
echo "Remaining $RETRIES retries" | |
fi | |
sleep 1 | |
done | |
echo [Wait done] | |
- name: Stop Server Container | |
if: always() | |
run: | | |
cd docker/server-env/ | |
docker compose down -v | |
- name: Stop Data Server Container | |
if: always() | |
run: | | |
cd docker/server-data-env/ | |
docker compose down -v | |
- name: Generate results | |
run: | | |
cd docker/speedtests/ | |
go run utils/plotter.go ${{ github.workspace }}/docker/server-data-env/output/data.csv "Server speed test [Delay:${{ env.CONNECT_DELAY_MS }}ms]" "perf-dw-speed" | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: server_${{ env.CONNECT_DELAY_MS }}ms | |
path: | | |
${{ github.workspace }}/docker/server-data-env/output/data.csv | |
${{ github.workspace }}/build/*.log | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: graph_server_${{ env.CONNECT_DELAY_MS }}ms | |
path: | | |
${{ github.workspace }}/docker/speedtests/data.png | |
- name: Cleanup | |
if: always() | |
run: | | |
sudo bash ${{ github.workspace }}/.github/workflows/set_delay_port.sh -d || true | |
sudo rm -rf docker/server-data-env/output/* || true | |
- name: Clean Docker data | |
if: failure() | |
run: | | |
docker system prune -af || true | |
- name: Auto-cancel workflow on error | |
if: failure() | |
uses: andymckay/[email protected] |