Skip to content
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

Implement Go benchmarking #171

Closed
Closed
17 changes: 15 additions & 2 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,20 @@ on:
- submodules/**
- go/**
- .github/workflows/go.yml
- .github/workflows/install-shared-dependencies/action.yml
- .github/workflows/install-redis/action.yml
- .github/workflows/test-benchmark/action.yml
- .github/workflows/lint-rust/action.yml
pull_request:
paths:
- glide-core/src/**
- submodules/**
- go/**
- .github/workflows/go.yml
- .github/workflows/install-shared-dependencies/action.yml
- .github/workflows/install-redis/action.yml
- .github/workflows/test-benchmark/action.yml
- .github/workflows/lint-rust/action.yml

concurrency:
group: go-${{ github.head_ref || github.ref }}
Expand Down Expand Up @@ -84,14 +92,19 @@ jobs:
working-directory: ./go
run: make test

- name: Upload cluster manager logs
- uses: ./.github/workflows/test-benchmark
with:
language-flag: -go

- name: Upload logs and reports
if: always()
continue-on-error: true
uses: actions/upload-artifact@v4
with:
name: cluster-manager-logs-${{ matrix.go }}-redis-${{ matrix.redis }}-${{ matrix.os }}
name: reports-go-${{ matrix.go }}-redis-${{ matrix.redis }}-${{ matrix.os }}
path: |
utils/clusters/**
benchmarks/results/**

build-amazonlinux-latest:
if: github.repository_owner == 'aws'
Expand Down
24 changes: 23 additions & 1 deletion benchmarks/install_and_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ runPython=0
runNode=0
runCsharp=0
runJava=0
runGo=0
runRust=0
concurrentTasks="1 10 100 1000"
dataSize="100 4000"
Expand Down Expand Up @@ -76,6 +77,11 @@ function runJavaBenchmark(){
./gradlew :benchmarks:run --args="-resultsFile \"${BENCH_FOLDER}/$1\" --dataSize \"$2\" --concurrentTasks \"$concurrentTasks\" --clients \"$chosenClients\" --host $host $portFlag --clientCount \"$clientCount\" $tlsFlag $clusterFlag $minimalFlag"
}

function runGoBenchmark(){
cd ${BENCH_FOLDER}/../go/benchmarks
go run . -resultsFile ${BENCH_FOLDER}/$1 -dataSize $2 -concurrentTasks $concurrentTasks -clients $chosenClients -host $host $portFlag -clientCount $clientCount $tlsFlag $clusterFlag $minimalFlag
}

function runRustBenchmark(){
rustConcurrentTasks=
for value in $concurrentTasks
Expand Down Expand Up @@ -115,7 +121,7 @@ function resultFileName() {

function Help() {
echo Running the script without any arguments runs all benchmarks.
echo Pass -node, -csharp, -python, -java as arguments in order to run the node, csharp, python, or java benchmarks accordingly.
echo Pass -node, -csharp, -python, -java, -go as arguments in order to run the node, csharp, python, java, or go benchmarks accordingly.
echo Multiple such flags can be passed.
echo Pass -no-csv to skip analysis of the results.
echo
Expand Down Expand Up @@ -203,6 +209,15 @@ do
runJava=1
chosenClients="Jedis"
;;
-go)
runAllBenchmarks=0
runGo=1
;;
-go-redis)
runAllBenchmarks=0
runGo=1
chosenClients="go-redis"
;;
-csharp)
runAllBenchmarks=0
runCsharp=1
Expand Down Expand Up @@ -270,6 +285,13 @@ do
runJavaBenchmark $javaResults $currentDataSize
fi

if [ $runAllBenchmarks == 1 ] || [ $runGo == 1 ];
then
goResults=$(resultFileName go $currentDataSize)
resultFiles+=$goResults" "
runGoBenchmark $goResults $currentDataSize
fi

if [ $runAllBenchmarks == 1 ] || [ $runRust == 1 ];
then
rustResults=$(resultFileName rust $currentDataSize)
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/utilities/csv_exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

json_file_name = os.path.basename(json_file_full_path)

languages = ["csharp", "node", "python", "rust", "java"]
languages = ["csharp", "node", "python", "rust", "java", "go"]
language = next(
(language for language in languages if language in json_file_name), None
)
Expand Down
12 changes: 12 additions & 0 deletions go/DEVELOPER.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,18 @@ Run from the main `/go` folder
make format
```

### Benchmarks

To run the benchmarks, execute the following:

```bash
cd go/benchmarks
# To see a list of available options and their defaults:
go run . -help
# An example command setting various options:
go run . -resultsFile gobenchmarks.json -dataSize "100 1000" -concurrentTasks "10 100" -clients all -host localhost -port 6379 -clientCount "1 5" -tls
```

### Recommended extensions for VS Code

- [Go](https://marketplace.visualstudio.com/items?itemName=golang.Go)
Expand Down
Loading
Loading