-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
ci: support for generating flame graph #6136
Merged
Merged
Changes from 71 commits
Commits
Show all changes
74 commits
Select commit
Hold shift + click to select a range
bdf4823
ci: add perf test and generate flame graph
tzssangglass 2d842f8
add trigger
tzssangglass 3a62b87
add perf.sh
tzssangglass 4bdae40
update install deps order
tzssangglass ffba68b
update
tzssangglass 1244a38
add debug
tzssangglass b9b32bc
add debug
tzssangglass 325f55a
rm debug
tzssangglass f40bbfb
Merge branch 'master' into flamegraph
tzssangglass 422370a
fix typo
tzssangglass a29ece5
add test
tzssangglass aec24c4
add install_stap_tools
tzssangglass 6070279
fix typo
tzssangglass d3cd626
remove bionic-security repo
tzssangglass 24d9d1c
test
tzssangglass 58d9eb5
rm debug
tzssangglass ef17fc7
chore order of cmd
tzssangglass aba8099
add debug
tzssangglass 5769b3b
build apisix-base
tzssangglass 4970bad
build apisix-base
tzssangglass 4445693
build apisix-base
tzssangglass 45699e5
build apisix-base
tzssangglass d03b9be
chore
tzssangglass d6c5000
chore
tzssangglass a434fc6
chore
tzssangglass b821024
basic completed
tzssangglass 80f6b15
rm debug
tzssangglass a604c01
chore
tzssangglass 45222c0
chore-2
tzssangglass 25d1a44
chore-3
tzssangglass 7693713
add debug
tzssangglass af50825
chore-4
tzssangglass 8e4770a
fix
tzssangglass ec26792
fix-2
tzssangglass d79458d
debug
tzssangglass f18af90
chore-5
tzssangglass 53a0e6d
rm debug
tzssangglass 7eae29b
fix-3
tzssangglass 24be7ac
fix-4
tzssangglass 1ad47b1
fix-5
tzssangglass 355c360
fix-6
tzssangglass d5e0e1c
fix-7
tzssangglass f84ea26
complete
tzssangglass a8d22f3
for test
tzssangglass 27aac2f
for test on apisix
tzssangglass 23a941f
add ldap
tzssangglass 7b0734b
adjust name
tzssangglass 4c6fa29
chore repo
tzssangglass 3c772f5
Merge branch 'master' of https://github.com/apache/apisix into flameg…
tzssangglass 16fcddb
adjust the trigger conditions and result display
tzssangglass 5639bc4
adjust the trigger conditions
tzssangglass 5d581ba
adjust the trigger conditions
tzssangglass aa406bf
echo test
tzssangglass 708223f
echo test
tzssangglass 91f62d0
echo test
tzssangglass b89c84d
echo test
tzssangglass 8b4ebf0
try with add action as submodule
tzssangglass 09c0de8
fix yaml format
tzssangglass c71c418
add test duration
tzssangglass e5f572e
rm local action
tzssangglass 1e5cb4c
rm echo test
tzssangglass 1ec68c7
add workflow for writing comments permissions in CI
tzssangglass a168e8f
fix typo
tzssangglass ef2ba3c
Merge branch 'master' of https://github.com/apache/apisix into flameg…
tzssangglass 8db8508
add comments
tzssangglass 8c03fd8
test for create comments
tzssangglass cd9d162
debug
tzssangglass b5c69de
fix CI error
tzssangglass 85947b3
rm echo
tzssangglass 703a6e9
rm unused code
tzssangglass 1ae6b6c
rm action
tzssangglass f876d1f
add comments
tzssangglass 900dd69
fix typo
tzssangglass 9f7901b
Merge branch 'master' of https://github.com/apache/apisix into flameg…
tzssangglass 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 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 |
---|---|---|
@@ -0,0 +1,56 @@ | ||
name: Performance Test | ||
|
||
on: | ||
pull_request: | ||
branches: [master, 'release/**'] | ||
paths-ignore: | ||
- 'docs/**' | ||
- '**/*.md' | ||
|
||
jobs: | ||
performance: | ||
if: github.event_name == 'pull_request' || github.event.label.name == 'performance' | ||
runs-on: ubuntu-18.04 | ||
timeout-minutes: 45 | ||
|
||
steps: | ||
- name: Check out code | ||
uses: actions/[email protected] | ||
with: | ||
submodules: recursive | ||
|
||
- name: Cache deps | ||
uses: actions/[email protected] | ||
env: | ||
cache-name: cache-deps | ||
with: | ||
path: deps | ||
key: ${{ runner.os }}-${{ env.cache-name }}-${{ matrix.os_name }}-${{ hashFiles('rockspec/apisix-master-0.rockspec') }} | ||
|
||
- name: Install Dependencies | ||
run: sudo ./ci/performance_test.sh install_dependencies | ||
|
||
- name: Install wrk2 | ||
run: sudo ./ci/performance_test.sh install_wrk2 | ||
|
||
- name: Install SystemTap Tools | ||
run: sudo ./ci/performance_test.sh install_stap_tools | ||
|
||
- name: Perf Test | ||
run: ./ci/performance_test.sh run_performance_test | ||
shuaijinchao marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
- name: Upload Performance Test Result | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: perf.txt | ||
path: | | ||
output/performance.txt | ||
retention-days: 3 | ||
|
||
- name: Upload flamegrpah | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: flamegraph.svg | ||
path: | | ||
output/flamegraph.svg | ||
retention-days: 3 |
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,117 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one or more | ||
# contributor license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright ownership. | ||
# The ASF licenses this file to You under the Apache License, Version 2.0 | ||
# (the "License"); you may not use this file except in compliance with | ||
# the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
. ./ci/common.sh | ||
|
||
set -ex | ||
|
||
install_dependencies() { | ||
apt-get -y update --fix-missing | ||
apt-get -y install lua5.1 liblua5.1-0-dev libldap2-dev | ||
export_or_prefix | ||
export OPENRESTY_VERSION=source | ||
./utils/linux-install-openresty.sh | ||
bash utils/install-dependencies.sh install_luarocks | ||
make deps | ||
} | ||
|
||
install_wrk2() { | ||
cd .. | ||
git clone https://github.com/giltene/wrk2 | ||
cd wrk2 || true | ||
make | ||
ln -s $PWD/wrk /usr/bin | ||
cd .. | ||
} | ||
|
||
install_stap_tools() { | ||
# install ddeb source repo | ||
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys C8CAB6595FDFF622 | ||
|
||
codename=$(lsb_release -c | awk '{print $2}') | ||
sudo tee /etc/apt/sources.list.d/ddebs.list << EOF | ||
deb http://ddebs.ubuntu.com/ ${codename} main restricted universe multiverse | ||
deb http://ddebs.ubuntu.com/ ${codename}-updates main restricted universe multiverse | ||
deb http://ddebs.ubuntu.com/ ${codename}-proposed main restricted universe multiverse | ||
EOF | ||
|
||
sudo apt-get update | ||
sudo apt-get install linux-image-$(uname -r)-dbgsym | ||
sudo apt install elfutils libdw-dev | ||
sudo apt-get install -y python3-setuptools python3-wheel | ||
|
||
# install systemtap | ||
cd /usr/local/ | ||
wget http://sourceware.org/systemtap/ftp/releases/systemtap-4.6.tar.gz | ||
tar -zxf systemtap-4.6.tar.gz | ||
mv systemtap-4.6 systemtap | ||
cd systemtap | ||
./configure && make all && sudo make install && stap --version | ||
cd .. | ||
|
||
# see https://github.com/openresty/stapxx/pull/48 | ||
git clone https://github.com/api7/stapxx.git -b luajit-gc64 | ||
git clone https://github.com/openresty/openresty-systemtap-toolkit.git | ||
git clone https://github.com/brendangregg/FlameGraph.git | ||
} | ||
|
||
|
||
run_performance_test() { | ||
sudo chmod -R 777 ./ | ||
ulimit -n 10240 | ||
|
||
pip3 install -r t/perf/requirements.txt --user | ||
|
||
#openresty-debug | ||
export OPENRESTY_PREFIX="/usr/local/openresty-debug" | ||
export PATH=$OPENRESTY_PREFIX/nginx/sbin:$OPENRESTY_PREFIX/bin:$OPENRESTY_PREFIX/luajit/bin:$PATH | ||
|
||
mkdir output | ||
python3 ./t/perf/test_http.py >$PWD/output/performance.txt 2>&1 & | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this script end up automatically? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, |
||
|
||
sleep 1 | ||
|
||
# stapxx | ||
export STAP_PLUS_HOME=/usr/local/stapxx | ||
export PATH=/usr/local/stapxx:/usr/local/stapxx/samples:$PATH | ||
# openresty-systemtap-toolkit | ||
export PATH=/usr/local/openresty-systemtap-toolkit:$PATH | ||
# FlameGraph | ||
export PATH=/usr/local/FlameGraph:$PATH | ||
|
||
sudo env PATH=$PATH /usr/local/stapxx/samples/lj-lua-stacks.sxx --arg time=30 --skip-badvars -x $(pgrep -P $(cat logs/nginx.pid) -n -f worker) > /tmp/tmp.bt | ||
sudo env PATH=$PATH /usr/local/openresty-systemtap-toolkit/fix-lua-bt /tmp/tmp.bt > /tmp/flame.bt | ||
sudo env PATH=$PATH /usr/local/FlameGraph/stackcollapse-stap.pl /tmp/flame.bt > /tmp/flame.cbt | ||
sudo env PATH=$PATH /usr/local/FlameGraph/flamegraph.pl /tmp/flame.cbt > $PWD/output/flamegraph.svg | ||
} | ||
|
||
case_opt=$1 | ||
case $case_opt in | ||
(install_dependencies) | ||
install_dependencies | ||
;; | ||
(install_wrk2) | ||
install_wrk2 | ||
;; | ||
(install_stap_tools) | ||
install_stap_tools | ||
;; | ||
(run_performance_test) | ||
run_performance_test | ||
;; | ||
esac |
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we only rely on the label? The pull request can be triggered by any user.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. However, the current test case only contains jwt-auth, and I feel that it seems too early to combine the user's PR with the test case. It would be nice to have targeted tests for the user's PR. Do you have any suggestions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can apply a label if needed. Note that people can run anything based on their PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now this PR is satisfied, add
performance
and it will run. To run it again you need to removeperformance
and add it again.Yes, the idealization is so. But this requires continued enhancements to the performance testing framework.
Maybe we can change it the next time we need to run performance tests for other PRs.