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

Pgo generate #871

Closed
wants to merge 3 commits into from
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
52 changes: 26 additions & 26 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -307,30 +307,30 @@ jobs:

- name: Run Load Tests
run: |
results=$(docker run --rm nginx-agent-load-test:1.0.0)
echo "$results" > benchmarks.json
echo "$results"
docker run --rm nginx-agent-load-test:1.0.0
ls
ls build

- name: Upload Load Test Results
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
with:
name: load-test-results
path: benchmarks.json
if-no-files-found: error

- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@4de1bed97a47495fc4c5404952da0499e31f5c29 # v1.20.3
with:
name: Compare Benchmark Results
tool: 'customSmallerIsBetter'
output-file-path: benchmarks.json
benchmark-data-dir-path: ""
# Set auto-push to false since GitHub API token is not given
auto-push: false
alert-threshold: '125%'
gh-pages-branch: "benchmark-results"
fail-on-alert: true

- name: Push load test result
if: ${{ success() && github.ref_name == 'v3'}}
run: git push 'https://github-actions:${{ secrets.GITHUB_TOKEN }}@github.com/nginx/agent.git' benchmark-results:benchmark-results
# - name: Upload Load Test Results
# uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
# with:
# name: load-test-results
# path: benchmarks.json
# if-no-files-found: error
#
# - name: Store benchmark result
# uses: benchmark-action/github-action-benchmark@4de1bed97a47495fc4c5404952da0499e31f5c29 # v1.20.3
# with:
# name: Compare Benchmark Results
# tool: 'customSmallerIsBetter'
# output-file-path: benchmarks.json
# benchmark-data-dir-path: ""
# # Set auto-push to false since GitHub API token is not given
# auto-push: false
# alert-threshold: '125%'
# gh-pages-branch: "benchmark-results"
# fail-on-alert: true
#
# - name: Push load test result
# if: ${{ success() && github.ref_name == 'v3'}}
# run: git push 'https://github-actions:${{ secrets.GITHUB_TOKEN }}@github.com/nginx/agent.git' benchmark-results:benchmark-results
9 changes: 5 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -236,16 +236,16 @@ local-rpm-package: ## Create local rpm package
@CGO_ENABLED=0 GOARCH=$(OSARCH) GOOS=linux $(GOBUILD) -o $(BUILD_DIR)/$(BINARY_NAME) -pgo=default.pgo -ldflags=$(LDFLAGS) $(PROJECT_DIR)/$(PROJECT_FILE)
ARCH=$(OSARCH) VERSION=$(shell echo $(VERSION) | tr -d 'v') $(GORUN) $(NFPM) pkg --config ./scripts/packages/.local-nfpm.yaml --packager rpm --target $(RPM_PACKAGE);

generate-pgo-profile: build-mock-management-plane-grpc
generate-pgo-profile: build-mock-management-plane-grpc load-test-image run-load-test-image
mv default.pgo profile.pprof
TEST_ENV="Container" CONTAINER_OS_TYPE=$(CONTAINER_OS_TYPE) BUILD_TARGET="install-agent-local" \
PACKAGES_REPO=$(OSS_PACKAGES_REPO) PACKAGE_NAME=$(PACKAGE_NAME) BASE_IMAGE=$(BASE_IMAGE) \
OS_VERSION=$(OS_VERSION) OS_RELEASE=$(OS_RELEASE) DOCKERFILE_PATH=$(DOCKERFILE_PATH) \
IMAGE_PATH=$(IMAGE_PATH) TAG=${IMAGE_TAG} CONTAINER_NGINX_IMAGE_REGISTRY=${CONTAINER_NGINX_IMAGE_REGISTRY} \
$(GOTEST) -v ./test/integration -cpuprofile integration_cpu.pprof
@CGO_ENABLED=0 $(GOTEST) -count 10 -timeout 5m -bench=. -benchmem -run=^# ./internal/watcher/instance -cpuprofile perf_watcher_cpu.pprof
@$(GOTOOL) pprof -proto perf_watcher_cpu.pprof integration_cpu.pprof > default.pgo
rm perf_watcher_cpu.pprof integration_cpu.pprof integration.test profile.pprof
@$(GOTOOL) pprof -proto perf_watcher_cpu.pprof integration_cpu.pprof ./build/load_cpu.pprof cpu.out > default.pgo
rm perf_watcher_cpu.pprof integration_cpu.pprof integration.test profile.pprof cpu.out ./build/load_cpu.pprof

# run under sudo locally
load-test-image: ## Build performance load testing image
Expand All @@ -255,7 +255,8 @@ load-test-image: ## Build performance load testing image
--secret id=nginx-crt,src=$(CERTS_DIR)/nginx-repo.crt \
--secret id=nginx-key,src=$(CERTS_DIR)/nginx-repo.key \
--build-arg OSARCH=$(OSARCH) \
--build-arg GO_VERSION=$(GO_VERSION)
--build-arg GO_VERSION=$(GO_VERSION) \
--build-arg ENTRY_POINT=./scripts/testing/load/entrypoint.sh

run-load-test-image: ## Run performance load testing image
$(CONTAINER_BUILDENV) $(CONTAINER_CLITOOL) run --rm -v $(PWD)/$(BUILD_DIR)/:/agent/$(BUILD_DIR)/ $(IMAGE_TAG)_load_test
Binary file modified default.pgo
Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading