-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[QT-602] Further optimize scenario listing and sampling
As we move to expand the variant list to tens and even hundreds of thousands of scenarios and variants in vault-enterprise, we ran into a few issues: * We hit our maximim gRPC message size when listing all the scenarios * Listing scenarios with extremely large matricies was too slow We make the following changes to help address those problems * gRPC max send and receive are now configurable in the CLI and have 5x larger defaults. * We identified a few hot spots in the program with profiling and further optimized them to reduce allocations and speed up comparisons. * We introduce a three-step build for artifacts. First we build the program with default compiler optimizations and profile the program. Then we rebuild it again using profile guided optimization. We then profile the program again and built it for a third time using profiles from our default and guided stages. Signed-off-by: Ryan Cragun <[email protected]>
- Loading branch information
1 parent
03cd231
commit 6fce568
Showing
18 changed files
with
518 additions
and
138 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: build | ||
description: build enos | ||
|
||
inputs: | ||
goarch: | ||
description: the GOARCH value | ||
required: true | ||
goos: | ||
description: the GOOS value | ||
required: true | ||
version: | ||
description: the version of the package | ||
required: true | ||
|
||
outputs: | ||
artifact-name: | ||
description: where the built artifact is located | ||
value: ${{ steps.build.outputs.artifact-name }} | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Build | ||
id: build | ||
env: | ||
ARTIFACT_NAME: enos_${{ inputs.product-version }}_${{ inputs.goos }}_${{ inputs.goarch }}.zip | ||
GOARCH: ${{ inputs.goarch }} | ||
GOOS: ${{ inputs.goos }} | ||
GOPRIVATE: 'github.com/hashicorp/*' | ||
shell: bash | ||
run: | | ||
mkdir -p dist out | ||
make | ||
echo "artifact-name="${{ env.ARTIFACT_NAME }}" >> "$GITHUB_OUTPUT" | ||
zip -r -j out/"${{ env.ARTIFACT_NAME }}" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
name: profile-build | ||
description: profile enos build | ||
|
||
inputs: | ||
build-path: | ||
description: where the enos artifact to profile is | ||
default: dist/enos | ||
profile-out: | ||
description: where to write the union cpu profile | ||
default: cpu.pprof | ||
merge-to-default: | ||
description: merge all cpu profiles to default.pgo arter profiling | ||
required: false | ||
default: true | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: profile | ||
shell: bash | ||
run: | | ||
${{ inputs.build-path }} scenario list --format json --chdir ./acceptance/scenarios/build_pgo/ | jq '.scenarios | length' | ||
mv cpu.pprof cpu.pprof.scenario.list | ||
${{ inputs.build-path }} scenario sample observe complex --max 10 --chdir ./acceptance/scenarios/build_pgo/ | ||
mv cpu.pprof cpu.pprof.sample.observe | ||
go tool pprof -proto cpu.pprof.scenario.list -proto cpu.pprof.sample.observe > ${{ inputs.profile-out }} | ||
- if: inputs.merge-to-default | ||
name: merge-to-default | ||
shell: bash | ||
run: | | ||
if test -f default.pgo; then | ||
cp default.pgo default.pprof | ||
go tool pprof -proto ${{ inputs.profile-out }} -proto default.pprof > default.pgo | ||
exit 0 | ||
fi | ||
cp ${{ inputs.profile-out }} default.pgo |
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,3 +35,5 @@ terraform.rc | |
/acceptance/support/private_key.pem | ||
|
||
**/.enos/* | ||
|
||
*.pprof |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
module "upgrade" { | ||
source = "./modules/upgrade" | ||
} | ||
|
||
module "replication" { | ||
source = "./modules/replication" | ||
} | ||
|
||
scenario "upgrade" { | ||
matrix { | ||
arch = ["amd64", "arm64"] | ||
artifact_source = ["local", "crt", "artifactory"] | ||
artifact_type = ["bundle", "package"] | ||
backend = ["consul", "raft"] | ||
consul_version = ["1.12.3", "1.13.6", "1.14.9", "1.15.5", "1.16.1"] | ||
distro = ["ubuntu", "rhel"] | ||
edition = ["ce", "ent", "ent.fips1402", "ent.hsm", "ent.hsm.fips1402"] | ||
initial_version = ["1.8.12", "1.9.10", "1.10.11", "1.11.12", "1.12.11", "1.13.6", "1.14.2"] | ||
seal = ["awskms", "shamir"] | ||
|
||
# Our local builder always creates bundles | ||
exclude { | ||
artifact_source = ["local"] | ||
artifact_type = ["package"] | ||
} | ||
|
||
# HSM and FIPS 140-2 are only supported on amd64 | ||
exclude { | ||
arch = ["arm64"] | ||
edition = ["ent.fips1402", "ent.hsm", "ent.hsm.fips1402"] | ||
} | ||
|
||
# FIPS 140-2 editions began at 1.10 | ||
exclude { | ||
edition = ["ent.fips1402", "ent.hsm.fips1402"] | ||
initial_version = ["1.8.12", "1.9.10"] | ||
} | ||
} | ||
|
||
step "upgrade" { | ||
module = module.upgrade | ||
} | ||
|
||
variables { | ||
az = matrix.distro | ||
} | ||
} | ||
|
||
scenario "replication" { | ||
matrix { | ||
arch = ["amd64", "arm64"] | ||
artifact_source = ["local", "crt", "artifactory"] | ||
artifact_type = ["bundle", "package"] | ||
backend = ["consul", "raft"] | ||
consul_version = ["1.12.3", "1.13.6", "1.14.9", "1.15.5", "1.16.1"] | ||
distro = ["ubuntu", "rhel"] | ||
edition = ["ce", "ent", "ent.fips1402", "ent.hsm", "ent.hsm.fips1402"] | ||
initial_version = ["1.8.12", "1.9.10", "1.10.11", "1.11.12", "1.12.11", "1.13.6", "1.14.2"] | ||
seal = ["awskms", "shamir"] | ||
|
||
# Our local builder always creates bundles | ||
exclude { | ||
artifact_source = ["local"] | ||
artifact_type = ["package"] | ||
} | ||
|
||
# HSM and FIPS 140-2 are only supported on amd64 | ||
exclude { | ||
arch = ["arm64"] | ||
edition = ["ent.fips1402", "ent.hsm", "ent.hsm.fips1402"] | ||
} | ||
|
||
# FIPS 140-2 editions began at 1.10 | ||
exclude { | ||
edition = ["ent.fips1402", "ent.hsm.fips1402"] | ||
initial_version = ["1.8.12", "1.9.10"] | ||
} | ||
} | ||
|
||
step "replication" { | ||
module = module.replication | ||
} | ||
|
||
variables { | ||
az = matrix.distro | ||
} | ||
} | ||
|
||
sample "complex" { | ||
attributes = { | ||
aws-region = ["us-west-1", "us-west-2"] | ||
continue-on-error = false | ||
} | ||
|
||
subset "upgrade_consul" { | ||
scenario_name = "upgrade" | ||
|
||
attributes = { | ||
continue-on-error = true | ||
} | ||
|
||
matrix { | ||
arch = ["amd64", "arm64"] | ||
backend = ["consul"] | ||
} | ||
} | ||
|
||
subset "upgrade_raft" { | ||
scenario_name = "replication" | ||
|
||
matrix { | ||
arch = ["amd64", "arm64"] | ||
backend = ["raft"] | ||
} | ||
} | ||
} |
Oops, something went wrong.