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

Added cgo profile to build NGINX Agent packages #472

Merged
merged 4 commits into from
Sep 13, 2023
Merged

Conversation

oliveromahony
Copy link
Contributor

@oliveromahony oliveromahony commented Sep 12, 2023

Proposed changes

Since go 1.20 https://go.dev/doc/pgo was introduced.
Added cgo production profile to build NGINX Agent packages. This reduces the CPU usage of the NGINX Agent from 4 - 9% 3 - 6%. Config Apply 17% -> 9% anecdotally. However, It does increase the package size. This is a tradeoff.

Enable #422

curl -s http://localhost:6060/debug/pprof/profile > ./cpu.out
mv profile.cgo profile.prof
go tool pprof -proto cpu.out profile.prof > profile.cgo
rm profile.prof cpu.out

Checklist

Before creating a PR, run through this checklist and mark each as complete.

  • I have read the CONTRIBUTING document
  • I have run make install-tools and have attached any dependency changes to this pull request
  • If applicable, I have added tests that prove my fix is effective or that my feature works
  • If applicable, I have checked that any relevant tests pass after adding my changes
  • If applicable, I have updated any relevant documentation (README.md)
  • If applicable, I have tested my cross-platform changes on Ubuntu 22, Redhat 8, SUSE 15 and FreeBSD 13

@netlify
Copy link

netlify bot commented Sep 12, 2023

Deploy Preview for agent-public-docs canceled.

Name Link
🔨 Latest commit 4f7d114
🔍 Latest deploy log https://app.netlify.com/sites/agent-public-docs/deploys/650061748feab70008500af0

@github-actions github-actions bot added chore Pull requests for routine tasks dependencies labels Sep 12, 2023
@codecov-commenter
Copy link

codecov-commenter commented Sep 12, 2023

Codecov Report

Patch coverage has no change and project coverage change: -0.51% ⚠️

Comparison is base (04748e8) 66.72% compared to head (4f7d114) 66.22%.
Report is 3 commits behind head on main.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #472      +/-   ##
==========================================
- Coverage   66.72%   66.22%   -0.51%     
==========================================
  Files         114      118       +4     
  Lines       12951    13274     +323     
==========================================
+ Hits         8642     8791     +149     
- Misses       3736     3900     +164     
- Partials      573      583      +10     
Files Changed Coverage Δ
...or/github.com/nginx/agent/sdk/v2/config_helpers.go 64.19% <ø> (ø)

... and 13 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@oliveromahony oliveromahony merged commit cd6c484 into main Sep 13, 2023
29 checks passed
@oliveromahony oliveromahony deleted the pprof-branch branch September 13, 2023 11:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Pull requests for routine tasks dependencies
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants