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

test: basic benchmarks for workflow archive DB operations #13767

Merged
merged 4 commits into from
Oct 21, 2024
Merged
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
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ E2E_WAIT_TIMEOUT ?= 90s # timeout for wait conditions
E2E_PARALLEL ?= 20
E2E_SUITE_TIMEOUT ?= 15m
GOTEST ?= go test -v -p 20
ALL_BUILD_TAGS ?= api,cli,cron,executor,examples,corefunctional,functional,plugins

# should we build the static files?
ifneq (,$(filter $(MAKECMDGOALS),codegen lint test docs start))
Expand Down Expand Up @@ -608,8 +609,10 @@ test-%-sdk:
make --directory sdks/$* install test -B

Test%:
E2E_WAIT_TIMEOUT=$(E2E_WAIT_TIMEOUT) go test -failfast -v -timeout $(E2E_SUITE_TIMEOUT) -count 1 --tags api,cli,cron,executor,examples,corefunctional,functional,plugins -parallel $(E2E_PARALLEL) ./test/e2e -run='.*/$*'
E2E_WAIT_TIMEOUT=$(E2E_WAIT_TIMEOUT) go test -failfast -v -timeout $(E2E_SUITE_TIMEOUT) -count 1 --tags $(ALL_BUILD_TAGS) -parallel $(E2E_PARALLEL) ./test/e2e -run='.*/$*'

Benchmark%:
go test --tags $(ALL_BUILD_TAGS) ./test/e2e -run='$@' -benchmem -bench .

# clean

Expand Down
2 changes: 1 addition & 1 deletion docs/running-locally.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ To test SSO integration, use `PROFILE=sso`:
make start UI=true PROFILE=sso
```

## TLS
### TLS
agilgur5 marked this conversation as resolved.
Show resolved Hide resolved

By default, `make start` will start Argo in [plain text mode](tls.md#plain-text).
To simulate a TLS proxy in front of Argo, use `UI_SECURE=true` (which implies `UI=true`):
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/fixtures/e2e_suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ func (s *E2ESuite) DeleteResources() {

// delete archived workflows from the archive
if s.Persistence.IsEnabled() {
archive := s.Persistence.workflowArchive
archive := s.Persistence.WorkflowArchive
parse, err := labels.ParseToRequirements(Label)
s.CheckError(err)
workflows, err := archive.ListWorkflows(utils.ListOptions{
Expand Down
6 changes: 3 additions & 3 deletions test/e2e/fixtures/persistence.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (
)

type Persistence struct {
WorkflowArchive sqldb.WorkflowArchive
session db.Session
offloadNodeStatusRepo sqldb.OffloadNodeStatusRepo
workflowArchive sqldb.WorkflowArchive
}

func newPersistence(kubeClient kubernetes.Interface, wcConfig *config.Config) *Persistence {
Expand All @@ -38,9 +38,9 @@ func newPersistence(kubeClient kubernetes.Interface, wcConfig *config.Config) *P
}
instanceIDService := instanceid.NewService(wcConfig.InstanceID)
workflowArchive := sqldb.NewWorkflowArchive(session, persistence.GetClusterName(), Namespace, instanceIDService)
return &Persistence{session, offloadNodeStatusRepo, workflowArchive}
return &Persistence{workflowArchive, session, offloadNodeStatusRepo}
} else {
return &Persistence{offloadNodeStatusRepo: sqldb.ExplosiveOffloadNodeStatusRepo, workflowArchive: sqldb.NullWorkflowArchive}
return &Persistence{offloadNodeStatusRepo: sqldb.ExplosiveOffloadNodeStatusRepo, WorkflowArchive: sqldb.NullWorkflowArchive}
}
}

Expand Down
64 changes: 64 additions & 0 deletions test/e2e/workflow_archive_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
//go:build functional

package e2e

import (
"testing"

"k8s.io/apimachinery/pkg/labels"

sutils "github.com/argoproj/argo-workflows/v3/server/utils"
"github.com/argoproj/argo-workflows/v3/test/e2e/fixtures"
)

func BenchmarkWorkflowArchive(b *testing.B) {
// Workaround for https://github.com/stretchr/testify/issues/811
suite := fixtures.E2ESuite{}
suite.SetT(&testing.T{})
suite.SetupSuite()
b.ResetTimer()

// Uncomment the following line to log queries to stdout
//db.LC().SetLevel(db.LogLevelDebug)

b.Run("ListWorkflows", func(b *testing.B) {
for range b.N {
wfs, err := suite.Persistence.WorkflowArchive.ListWorkflows(sutils.ListOptions{
Limit: 100,
})
if err != nil {
b.Fatal(err)
}
b.Logf("Found %d workflows", wfs.Len())
}
})

b.Run("ListWorkflows with label selector", func(b *testing.B) {
requirements, err := labels.ParseToRequirements("workflows.argoproj.io/phase=Succeeded")
if err != nil {
b.Fatal(err)
}
for range b.N {
wfs, err := suite.Persistence.WorkflowArchive.ListWorkflows(sutils.ListOptions{
Limit: 100,
LabelRequirements: requirements,
})
if err != nil {
b.Fatal(err)
}
b.Logf("Found %d workflows", wfs.Len())
}
})

b.Run("CountWorkflows", func(b *testing.B) {
for range b.N {
wfCount, err := suite.Persistence.WorkflowArchive.CountWorkflows(sutils.ListOptions{})
if err != nil {
b.Fatal(err)
}
b.Logf("Found %d workflows", wfCount)
}
})

suite.TearDownSuite()
}
Loading