-
Notifications
You must be signed in to change notification settings - Fork 107
Add performance profiling pipeline to perf tests #1392
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
Merged
Merged
Changes from all commits
Commits
Show all changes
130 commits
Select commit
Hold shift + click to select a range
1cca288
create py spy pipeline
YunchuWang 515def1
fix
YunchuWang 402da15
setup profiling pipeline
YunchuWang 292daa8
update pipeline name
YunchuWang 490848c
fix
YunchuWang b55e1f0
fix
YunchuWang 9a6743f
Update profiling.yml
YunchuWang 6724dbe
Update perf-testing-setup.yml
YunchuWang 3563fb3
Update perf-testing-setup.yml
YunchuWang aa3cbcd
Update perf-testing-setup.yml
YunchuWang 6095eb4
Update perf-testing-setup.yml
YunchuWang dc27bd4
Update perf-testing-setup.yml
YunchuWang 3b7ee0e
Update perf-testing-setup.yml
YunchuWang b04112a
Update perf-testing-setup.yml
YunchuWang 9a3b35c
Update perf-testing-setup.yml
YunchuWang f429266
Update perf-testing-setup.yml
YunchuWang 5d42f6e
Update perf-testing-setup.yml
YunchuWang 0475bf8
Update perf-testing-setup.yml
YunchuWang 8088a0d
Update perf-testing-setup.yml
YunchuWang 3f34723
Update perf_tests.Dockerfile
YunchuWang 13bb394
Update perf_tests.Dockerfile
YunchuWang d8882d9
Update perf_tests.Dockerfile
YunchuWang edfe0b9
Update perf_tests.Dockerfile
YunchuWang 7e0fb2b
Update perf-testing-setup.yml
YunchuWang c74ec1d
Update perf-testing-setup.yml
YunchuWang 9b67694
Update perf_tests.Dockerfile
YunchuWang 5b0bddf
Update perf-testing-setup.yml
YunchuWang a370113
Update perf-testing-setup.yml
YunchuWang e02cccd
logging
YunchuWang 0bb2b6c
Update perf-testing-setup.yml
YunchuWang 4ca1a98
Update perf-testing-setup.yml
YunchuWang 6343921
Update perf-testing-setup.yml
YunchuWang c6c2b61
Update perf_tests.Dockerfile
YunchuWang c729ca9
Update perf_tests.Dockerfile
YunchuWang f3fe293
Update perf-testing-setup.yml
YunchuWang 7945de9
Update SyncHttpTriggerHelloWorld.js
YunchuWang e6a97c3
Update perf-testing-setup.yml
YunchuWang b63992b
Update perf-testing-setup.yml
YunchuWang 68c49cd
Update perf-testing-setup.yml
YunchuWang fb4b719
Update perf-testing-setup.yml
YunchuWang 88f8422
Update perf-testing-setup.yml
YunchuWang 78d1a8c
Update perf-testing-setup.yml
YunchuWang 0759724
Update perf-testing-setup.yml
YunchuWang 3de22b9
Update perf-testing-setup.yml
YunchuWang 1cc2b23
fix
YunchuWang fba036a
rename
YunchuWang 34014f1
Update perf-testing-setup.yml
YunchuWang 060fd4b
Update perf-testing-setup.yml
YunchuWang 242bc15
Update perf-testing-setup.yml
YunchuWang 05ad2ac
Update perf-testing-setup.yml
YunchuWang e14ddb5
Update perf-testing-setup.yml
YunchuWang 7757eb1
Update perf-testing-setup.yml
YunchuWang 32f19df
Update perf-testing-setup.yml
YunchuWang 59c3c0e
Update perf-testing-setup.yml
YunchuWang 415b591
Update perf-testing-setup.yml
YunchuWang 5088cc8
Update perf-testing-setup.yml
YunchuWang 8325a99
Update perf-testing-setup.yml
YunchuWang e73b25e
Update perf-testing-setup.yml
YunchuWang 896d54d
Update perf-testing-setup.yml
YunchuWang c6bcafb
Update perf-testing-setup.yml
YunchuWang 04e594b
Update perf-testing-setup.yml
YunchuWang 7cdeb1e
Update perf-testing-setup.yml
YunchuWang 38ee2b7
Update perf-testing-setup.yml
YunchuWang fdbf460
Update perf-testing-setup.yml
YunchuWang aa94fa7
Update perf-testing-setup.yml
YunchuWang 3621ece
Update perf-testing-setup.yml
YunchuWang ee0b510
Update perf-testing-setup.yml
YunchuWang adedd72
Update perf-testing-setup.yml
YunchuWang a7345e4
Update perf-testing-setup.yml
YunchuWang 661b2ea
Update perf-testing-setup.yml
YunchuWang f1e3c02
Update perf-testing-setup.yml
YunchuWang 1a26d4e
Update perf-testing-setup.yml
YunchuWang 586cc90
Update perf-testing-setup.yml
YunchuWang 7995480
Update perf-testing-setup.yml
YunchuWang 2067472
Update perf-testing-setup.yml
YunchuWang f31a786
Update perf-testing-setup.yml
YunchuWang aea1be6
Update perf-testing-setup.yml
YunchuWang f11df87
Update perf-testing-setup.yml
YunchuWang a030f1c
Update perf-testing-setup.yml
YunchuWang ebd9eda
Update perf-testing-setup.yml
YunchuWang 4999eb9
Update perf-testing-setup.yml
YunchuWang b20eaae
Update perf-testing-setup.yml
YunchuWang 8cf6502
Update perf-testing-setup.yml
YunchuWang 5751a82
Update perf-testing-setup.yml
YunchuWang efe0569
Update perf-testing-setup.yml
YunchuWang 5384722
Update perf-testing-setup.yml
YunchuWang fd2fdf5
Update perf-testing-setup.yml
YunchuWang 2453a87
Update perf-testing-setup.yml
YunchuWang d81e8ed
Update perf-testing-setup.yml
YunchuWang 1e6a011
Update perf-testing-setup.yml
YunchuWang ad695f7
Update perf-testing-setup.yml
YunchuWang 92b5d55
Update perf-testing-setup.yml
YunchuWang e7bf70f
Update perf-testing-setup.yml
YunchuWang ffb0c1f
Update perf-testing-setup.yml
YunchuWang ebad3a6
clean up
YunchuWang 4e7340e
fix feedback
YunchuWang 69b77fb
add newline
YunchuWang 691af33
fix feedback
YunchuWang 724d261
fix feedback
YunchuWang af1e2d4
Merge branch 'dev' into wangbill/py-spy-pipeline
YunchuWang 5305476
fix
YunchuWang c03764c
Update perf-testing-setup.yml
YunchuWang 3576b16
Update perf-testing-setup.yml
YunchuWang 294be7b
Update perf-testing-setup.yml
YunchuWang b080280
Update perf-testing-setup.yml
YunchuWang 8faf4d8
Update perf-testing-setup.yml
YunchuWang 346dc44
Update perf-testing-setup.yml
YunchuWang a9cdaac
Update perf-testing-setup.yml
YunchuWang eb8e197
Update perf-testing-setup.yml
YunchuWang 7cdf40d
Update .github/workflows/perf-testing-setup.yml
YunchuWang f9452a3
include br name
YunchuWang 79df75f
Update perf-testing-setup.yml
YunchuWang 306c9f3
Update perf-testing-setup.yml
YunchuWang 8a7d910
Update perf-testing-setup.yml
YunchuWang 8308bfc
Update perf-testing-setup.yml
YunchuWang 17da633
Update perf-testing-setup.yml
YunchuWang 2d113cc
Update perf-testing-setup.yml
YunchuWang eacf00e
Update perf-testing-setup.yml
YunchuWang 7ccd114
Update perf-testing-setup.yml
YunchuWang 0126ef6
Update perf-testing-setup.yml
YunchuWang b89d961
Update perf-testing-setup.yml
YunchuWang 822b60e
Update perf-testing-setup.yml
YunchuWang 8ad6add
Update perf-testing-setup.yml
YunchuWang ab51f58
Update perf_tests.Dockerfile
YunchuWang 8c56fd7
Update perf-testing-setup.yml
YunchuWang 1b19f3e
Update perf-testing-setup.yml
YunchuWang 5bba459
Update perf-testing-setup.yml
YunchuWang 3afc460
Update perf-testing-setup.yml
YunchuWang f99bce1
Update perf-testing-setup.yml
YunchuWang e4c4a96
Update perf-testing-setup.yml
YunchuWang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
|
@@ -2,35 +2,37 @@ name: Throughput testing workflow | |
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
YunchuWang marked this conversation as resolved.
Show resolved
Hide resolved
|
||
branches: [ dev ] | ||
|
||
inputs: | ||
profiling_sampling_rate: | ||
description: 'Profiling sampling rate (tps)' | ||
required: false | ||
default: '500' | ||
YunchuWang marked this conversation as resolved.
Show resolved
Hide resolved
|
||
test_to_run: | ||
description: 'List of perf tests to run' | ||
required: false | ||
default: SyncHelloWorld | ||
issue_comment: | ||
types: [created] | ||
env: | ||
TESTS_DIR_PATH: ".ci/perf_tests/k6scripts/" | ||
PYTHON_VERSION: "3.8" | ||
PYTHON_VERSION: "3.10" | ||
PYTHON_FUNCTION_PROFILING_STORAGE_ACCT: "azpyfuncpipelinestorage" | ||
PORT: 8000 | ||
|
||
jobs: | ||
build: | ||
if: ${{ github.event_name == 'workflow_dispatch' || github.event.issue.pull_request && contains(github.event.comment.body, '/profile') }} | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
test_to_run: [ SyncHttpTriggerHelloWorld ] | ||
test_to_run: ['${{ github.event.inputs.test_to_run }}'] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python ${{ env.PYTHON_VERSION }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ env.PYTHON_VERSION }} | ||
- name: Set up Dotnet 2.x | ||
uses: actions/setup-dotnet@v1 | ||
with: | ||
dotnet-version: '3.1.405' | ||
- name: Set up Dotnet 6.x | ||
uses: actions/setup-dotnet@v1 | ||
with: | ||
dotnet-version: '6.x' | ||
- name: Setup k6 for throughput testing | ||
run: | | ||
cd $GITHUB_WORKSPACE | ||
|
@@ -47,13 +49,76 @@ jobs: | |
python setup.py extension | ||
YunchuWang marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- name: Build and Run the Docker image | ||
run: | | ||
echo "Building Docker image with Python version ${{ env.PYTHON_VERSION }}" | ||
docker build --build-arg PYTHON_VERSION=${{ env.PYTHON_VERSION }} --file .ci/perf_tests/dockerfiles/perf_tests.Dockerfile --tag perfimage:latest . | ||
docker run -d --shm-size="2g" --env FUNCTIONS_WORKER_RUNTIME_VERSION=${{ env.PYTHON_VERSION }} -p ${PORT}:80 -v $GITHUB_WORKSPACE/azure_functions_worker:/azure-functions-host/workers/python/${{ env.PYTHON_VERSION }}/LINUX/X64/azure_functions_worker perfimage:latest | ||
|
||
echo "Running Docker container..." | ||
container_id=$(docker run -d --privileged --env FUNCTIONS_WORKER_RUNTIME_VERSION=${{ env.PYTHON_VERSION }} -p ${PORT}:80 -v $GITHUB_WORKSPACE/azure_functions_worker:/azure-functions-host/workers/python/${{ env.PYTHON_VERSION }}/LINUX/X64/azure_functions_worker perfimage:latest) | ||
sleep 10 # host needs some time to start. | ||
echo "Container ID is $container_id" | ||
|
||
echo "Fetching Docker container logs..." | ||
docker logs $container_id | ||
worker_pid=$(docker exec $container_id sh -c "ps aux | grep '[p]ython'" | awk '{print $2}') | ||
YunchuWang marked this conversation as resolved.
Show resolved
Hide resolved
|
||
echo "Python worker process id is $worker_pid" | ||
|
||
echo "container_id=$container_id" >> $GITHUB_ENV | ||
echo "worker_pid=$worker_pid" >> $GITHUB_ENV | ||
|
||
- name: Validate if the functions are now running | ||
run: | | ||
curl --get http://localhost:${PORT}/api/${{ matrix.test_to_run }} | ||
|
||
- name: Start py-spy in the background | ||
run: | | ||
docker exec $container_id sh -c "pip install py-spy" | ||
docker exec $container_id sh -c "mkdir /home/profiling_reports" | ||
profiling_sampling_rate=${{ github.event.inputs.profiling_sampling_rate }} | ||
# report_name="${GITHUB_REF#refs/heads/}_${{ github.run_id }}.svg" | ||
report_name="${{ github.run_id }}.svg" | ||
docker exec -d $container_id sh -c "RUST_BACKTRACE=1 py-spy record -p $worker_pid -o /home/profiling_reports/$report_name -f flamegraph --idle --nonblocking --rate $profiling_sampling_rate > /home/site/wwwroot/py-spy.log 2>&1 &" | ||
sleep 2 # Give it a moment to start | ||
py_spy_id=$(docker exec $container_id sh -c "ps aux | grep '[p]y-spy record'" | awk '{print $2}') | ||
YunchuWang marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
echo "py_spy_id=$py_spy_id" >> $GITHUB_ENV | ||
echo "report_name=$report_name" >> $GITHUB_ENV | ||
|
||
- name: Run Throughput tests | ||
run: | | ||
chmod 755 .ci/perf_tests/run-perftests.sh | ||
.ci/perf_tests/run-perftests.sh localhost $PORT ${{ env.TESTS_DIR_PATH }} ${{ matrix.test_to_run }} | ||
|
||
- name: Stop profiling and generate report | ||
YunchuWang marked this conversation as resolved.
Show resolved
Hide resolved
|
||
run: | | ||
echo "Tests completed, terminating py-spy..." | ||
docker exec $container_id cat /home/site/wwwroot/py-spy.log | ||
docker exec $container_id sh -c "kill -2 $py_spy_id" | ||
sleep 2 | ||
|
||
mkdir profiling_reports | ||
chmod 777 profiling_reports | ||
docker cp $container_id:/home/profiling_reports/$report_name profiling_reports | ||
|
||
- name: Upload SVG to Azure Blob Storage | ||
uses: bacongobbler/[email protected] | ||
YunchuWang marked this conversation as resolved.
Show resolved
Hide resolved
|
||
with: | ||
source_dir: 'profiling_reports' # Directory containing the $report_name file | ||
container_name: 'profiling' | ||
connection_string: ${{ secrets.AZURE_STORAGE_CONNECTION_STRING }} | ||
sync: 'false' | ||
|
||
- name: Output Blob URL | ||
run: | | ||
blob_url="https://${{ env.PYTHON_FUNCTION_PROFILING_STORAGE_ACCT }}.blob.core.windows.net/profiling/${{ env.report_name }}" | ||
echo "You can view the Blob at: $blob_url" | ||
YunchuWang marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
- name: Upload profiling result to artifact | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: py-spy-output | ||
path: 'profiling_reports/${{ env.report_name }}' | ||
|
||
- name: Create Artifact Link | ||
run: | | ||
echo "You can download the SVG artifact from the Actions run page." | ||
echo "Link to the Actions run page: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.