Skip to content

Commit

Permalink
fix(perf) better nginx upstream conf, use correct stackcollaps script (
Browse files Browse the repository at this point in the history
  • Loading branch information
fffonion authored Jun 11, 2021
1 parent 163d61e commit 9f2b1d9
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 11 deletions.
2 changes: 1 addition & 1 deletion spec/helpers/perf/drivers/local.lua
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ function _M:generate_flamegraph(title)

local cmds = {
"/tmp/perf-ost/fix-lua-bt " .. path .. ".bt > " .. path .. ".fbt",
"/tmp/perf-fg/stackcollapse.pl " .. path .. ".fbt > " .. path .. ".cbt",
"/tmp/perf-fg/stackcollapse-stap.pl " .. path .. ".fbt > " .. path .. ".cbt",
"/tmp/perf-fg/flamegraph.pl --title='" .. title .. "' " .. path .. ".cbt > " .. path .. ".svg",
"cat " .. path .. ".svg",
}
Expand Down
37 changes: 27 additions & 10 deletions spec/helpers/perf/drivers/terraform.lua
Original file line number Diff line number Diff line change
Expand Up @@ -166,14 +166,31 @@ end

function _M:start_upstream(conf)
conf = conf or ""
conf = ngx.encode_base64(([[server {
listen %d;
access_log off;
location =/health {
return 200;
}
%s
}]]):format(UPSTREAM_PORT, conf)):gsub("\n", "")
conf = ngx.encode_base64(([[
worker_processes auto;
worker_cpu_affinity auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
worker_rlimit_nofile 20480;
events {
accept_mutex off;
worker_connections 10620;
}
http {
access_log off;
server_tokens off;
keepalive_requests 10000;
tcp_nodelay on;
server {
listen %d reuseport;
location / {
return 200 " performancetestperformancetestperformancetestperformancetestperformancetest";
}
}
}]]):format(UPSTREAM_PORT, conf)):gsub("\n", "")

local ok, err = execute_batch(self, self.worker_ip, {
"sudo id",
Expand All @@ -182,7 +199,7 @@ function _M:start_upstream(conf)
-- ubuntu where's wrk in apt?
"wget -nv http://mirrors.kernel.org/ubuntu/pool/universe/w/wrk/wrk_4.1.0-3_amd64.deb -O wrk.deb",
"dpkg -l wrk || (sudo dpkg -i wrk.deb || sudo apt-get -f -y install)",
"echo " .. conf .. " | sudo base64 -d > /etc/nginx/conf.d/perf-test.conf",
"echo " .. conf .. " | sudo base64 -d > /etc/nginx/nginx.conf",
"sudo nginx -t",
"sudo systemctl restart nginx",
})
Expand Down Expand Up @@ -352,7 +369,7 @@ function _M:generate_flamegraph(title)

local ok, err = execute_batch(self, self.kong_ip, {
"/tmp/perf-ost/fix-lua-bt " .. path .. ".bt > " .. path .. ".fbt",
"/tmp/perf-fg/stackcollapse.pl " .. path .. ".fbt > " .. path .. ".cbt",
"/tmp/perf-fg/stackcollapse-stap.pl " .. path .. ".fbt > " .. path .. ".cbt",
"/tmp/perf-fg/flamegraph.pl --title='" .. title .. "' " .. path .. ".cbt > " .. path .. ".svg",
})
if not ok then
Expand Down

0 comments on commit 9f2b1d9

Please sign in to comment.