Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add benchmark job and update benchmark results #713

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 3 additions & 14 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,15 @@ on:
- 'scripts/**'

jobs:
check:
benchmark:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
# check-dco will check the last 20 commits, but commit ranges
# exclude the start commit in the result, but need that commit
# in order to calculate the range. i.e. HEAD~20..HEAD includes
# 20 commits, but including HEAD it needs 21 commits.
fetch-depth: 21
- uses: actions/setup-go@v4
with:
go-version: '1.18.10'
- run: wget https://github.com/google/flatbuffers/releases/download/v22.9.29/Linux.flatc.binary.g++-10.zip
- run: unzip Linux.flatc.binary.g++-10.zip
- run: ./scripts/install-check-tools.sh
- run: ./scripts/check-ltag.sh
- run: ./scripts/check-dco.sh
- run: ./scripts/check-lint.sh
- run: PATH=$PATH:$(pwd) ./scripts/check-flatc.sh
- run: make
- run: make benchmarks
test:
runs-on: ubuntu-20.04
steps:
Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/prebuild.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Pre-build

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
check:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
# check-dco will check the last 20 commits, but commit ranges
# exclude the start commit in the result, but need that commit
# in order to calculate the range. i.e. HEAD~20..HEAD includes
# 20 commits, but including HEAD it needs 21 commits.
fetch-depth: 21
- uses: actions/setup-go@v4
with:
go-version: '1.18.10'
- run: wget https://github.com/google/flatbuffers/releases/download/v22.9.29/Linux.flatc.binary.g++-10.zip
- run: unzip Linux.flatc.binary.g++-10.zip
- run: ./scripts/install-check-tools.sh
- run: ./scripts/check-ltag.sh
- run: ./scripts/check-dco.sh
- run: ./scripts/check-lint.sh
- run: PATH=$PATH:$(pwd) ./scripts/check-flatc.sh
22 changes: 22 additions & 0 deletions benchmark/benchmarkTests.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package benchmark
import (
"context"
"testing"
"time"

"github.com/awslabs/soci-snapshotter/benchmark/framework"
"github.com/containerd/containerd"
Expand Down Expand Up @@ -107,10 +108,13 @@ func SociFullRun(
defer sociProcess.StopProcess()
sociContainerdProc := SociContainerdProcess{containerdProcess}
b.ResetTimer()
pullStart := time.Now()
log.G(ctx).WithField("benchmark", "Test").WithField("event", "Start").Infof("Start Test")
log.G(ctx).WithField("benchmark", "Pull").WithField("event", "Start").Infof("Start Pull Image")
image, err := sociContainerdProc.SociRPullImageFromRegistry(ctx, imageRef, indexDigest)
log.G(ctx).WithField("benchmark", "Pull").WithField("event", "Stop").Infof("Stop Pull Image")
pullDuration := time.Since(pullStart)
b.ReportMetric(float64(pullDuration.Milliseconds()), "pullDuration")
if err != nil {
b.Fatalf("%s", err)
}
Expand All @@ -129,8 +133,11 @@ func SociFullRun(
}
defer cleanupTask()
log.G(ctx).WithField("benchmark", "RunTask").WithField("event", "Start").Infof("Start Run Task")
runTask1Start := time.Now()
cleanupRun, err := sociContainerdProc.RunContainerTaskForReadyLine(ctx, taskDetails, readyLine)
runTask1Duration := time.Since(runTask1Start)
log.G(ctx).WithField("benchmark", "RunTask").WithField("event", "Stop").Infof("Stop Run Task")
b.ReportMetric(float64(runTask1Duration.Milliseconds()), "runTask1Duration")
if err != nil {
b.Fatalf("%s", err)
}
Expand All @@ -146,8 +153,11 @@ func SociFullRun(
}
defer cleanupTaskSecondRun()
log.G(ctx).WithField("benchmark", "RunTaskTwice").WithField("event", "Start").Infof("Start Run Task Twice")
runTask2Start := time.Now()
cleanupRunSecond, err := sociContainerdProc.RunContainerTaskForReadyLine(ctx, taskDetailsSecondRun, readyLine)
runTask2Duration := time.Since(runTask2Start)
log.G(ctx).WithField("benchmark", "RunTaskTwice").WithField("event", "Stop").Infof("Stop Run Task Twice")
b.ReportMetric(float64(runTask2Duration.Milliseconds()), "runTask2Duration")
if err != nil {
b.Fatalf("%s", err)
}
Expand All @@ -173,8 +183,11 @@ func OverlayFSFullRun(
b.ResetTimer()
log.G(ctx).WithField("benchmark", "Test").WithField("event", "Start").Infof("Start Test")
log.G(ctx).WithField("benchmark", "Pull").WithField("event", "Start").Infof("Start Pull Image")
pullStart := time.Now()
image, err := containerdProcess.PullImageFromRegistry(ctx, imageRef, platform)
pullDuration := time.Since(pullStart)
log.G(ctx).WithField("benchmark", "Pull").WithField("event", "Stop").Infof("Stop Pull Image")
b.ReportMetric(float64(pullDuration.Milliseconds()), "pullDuration")
if err != nil {
b.Fatalf("%s", err)
}
Expand All @@ -185,8 +198,11 @@ func OverlayFSFullRun(
b.Fatalf("%s", err)
}
log.G(ctx).WithField("benchmark", "CreateContainer").WithField("event", "Start").Infof("Start Create Container")
createContainerStart := time.Now()
container, cleanupContainer, err := containerdProcess.CreateContainer(ctx, image)
createContainerDuration := time.Since(createContainerStart)
log.G(ctx).WithField("benchmark", "CreateContainer").WithField("event", "Stop").Infof("Stop Create Container")
b.ReportMetric(float64(createContainerDuration.Milliseconds()), "createContainerDuration")
if err != nil {
b.Fatalf("%s", err)
}
Expand All @@ -199,8 +215,11 @@ func OverlayFSFullRun(
}
defer cleanupTask()
log.G(ctx).WithField("benchmark", "RunTask").WithField("event", "Start").Infof("Start Run Task")
runTask1Start := time.Now()
cleanupRun, err := containerdProcess.RunContainerTaskForReadyLine(ctx, taskDetails, readyLine)
runTask1Duration := time.Since(runTask1Start)
log.G(ctx).WithField("benchmark", "RunTask").WithField("event", "Stop").Infof("Stop Run Task")
b.ReportMetric(float64(runTask1Duration.Milliseconds()), "runTask1Duration")
if err != nil {
b.Fatalf("%s", err)
}
Expand All @@ -216,8 +235,11 @@ func OverlayFSFullRun(
}
defer cleanupTaskSecondRun()
log.G(ctx).WithField("benchmark", "RunTaskTwice").WithField("event", "Start").Infof("Start Run Task Twice")
runTask2Start := time.Now()
cleanupRunSecond, err := containerdProcess.RunContainerTaskForReadyLine(ctx, taskDetailsSecondRun, readyLine)
runTask2Duration := time.Since(runTask2Start)
log.G(ctx).WithField("benchmark", "RunTaskTwice").WithField("event", "Stop").Infof("Stop Run Task Twice")
b.ReportMetric(float64(runTask2Duration.Milliseconds()), "runTask2Duration")
if err != nil {
b.Fatalf("%s", err)
}
Expand Down
Loading