Skip to content

Commit

Permalink
Minor updates for the existing benchmark process (#486)
Browse files Browse the repository at this point in the history
* Minor updates for the existing process.

Signed-off-by: Hiromi Suenaga <[email protected]>

* Updating make clean to delete benchmark output folders

Signed-off-by: Hiromi Suenaga <[email protected]>

* Removing `MODE=0` from `make integration`

Signed-off-by: Hiromi Suenaga <[email protected]>
  • Loading branch information
hiromis authored Aug 11, 2021
1 parent bce9cd9 commit 1166fa6
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 8 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ examples/dyplomat/dyplomat
# Benchmarking artifacts
*.gz
*.pprof
/benchmarks/reports
/benchmarks/pngs
16 changes: 9 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ clean:
@rm -rf $(BINDIR)
@rm -rf *.log
@rm -rf *.pprof
@rm -rf benchmarks/reports
@rm -rf benchmarks/pngs

# TODO(mattklein123): See the note in TestLinearConcurrentSetWatch() for why we set -parallel here
# This should be removed.
Expand Down Expand Up @@ -63,30 +65,30 @@ $(BINDIR)/test:
integration: integration.xds integration.ads integration.rest integration.xds.mux integration.xds.delta integration.ads.delta

integration.ads: $(BINDIR)/test $(BINDIR)/upstream
env XDS=ads MODE=0 build/integration.sh
env XDS=ads build/integration.sh

integration.xds: $(BINDIR)/test $(BINDIR)/upstream
env XDS=xds MODE=0 build/integration.sh
env XDS=xds build/integration.sh

integration.rest: $(BINDIR)/test $(BINDIR)/upstream
env XDS=rest MODE=0 build/integration.sh
env XDS=rest build/integration.sh

integration.xds.mux: $(BINDIR)/test $(BINDIR)/upstream
env XDS=xds MODE=0 build/integration.sh -mux
env XDS=xds build/integration.sh -mux

integration.xds.delta: $(BINDIR)/test $(BINDIR)/upstream
env XDS=delta MODE=0 build/integration.sh
env XDS=delta build/integration.sh

integration.ads.delta: $(BINDIR)/test $(BINDIR)/upstream
env XDS=delta-ads MODE=0 build/integration.sh
env XDS=delta-ads build/integration.sh


#------------------------------------------------------------------------------
# Benchmarks utilizing intergration tests
#------------------------------------------------------------------------------
.PHONY: benchmark docker_benchmarks
benchmark: $(BINDIR)/test $(BINDIR)/upstream
env XDS=xds MODE=$(MODE) build/integration.sh
env XDS=xds build/integration.sh

docker_benchmarks:
docker build --pull -f Dockerfile.ci . -t gcp_ci && \
Expand Down
10 changes: 10 additions & 0 deletions benchmarks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,16 @@ const (
```
To specifiy the mode, use `MODE` environment variable that corresponds to the output you wish to evaluate.

The output file will be stored at the project root with .pprof extension (e.g. `cpu.pprof`).

Run `pprof` tool like so which will open up a shell. From there, you can run command such as `web` to visualize the result:

```bash
go tool pprof cpu.pprof
(pprof) web
```
For more information, run `help`.

## Running With Docker

To run the benchmarks, we just require the prerequisite of docker and go.
Expand Down
3 changes: 3 additions & 0 deletions build/do_benchmarks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ make benchmark MODE=2
make benchmark MODE=3
make benchmark MODE=4

mkdir -p benchmarks/reports
mkdir -p benchmarks/pngs

# generate our consumable pprof profiles
pprof -text bin/test cpu.pprof > benchmarks/reports/cpu_text.txt
pprof -tree bin/test cpu.pprof > benchmarks/reports/cpu_tree.txt
Expand Down
2 changes: 1 addition & 1 deletion build/integration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ MESSAGE=$'Hi, there!\n'
XDS=${XDS:-ads}

# pprof profiler mode
MODE=${MODE:0}
MODE=${MODE:-0}

# Number of RTDS layers.
if [ "$XDS" = "ads" ]; then
Expand Down

0 comments on commit 1166fa6

Please sign in to comment.