Skip to content

Commit

Permalink
chore: use native go benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
adityathebe committed Dec 18, 2024
1 parent 0983a40 commit 028c615
Show file tree
Hide file tree
Showing 5 changed files with 268 additions and 411 deletions.
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ test: ginkgo

.PHONY: bench
bench:
go build -o ./.bin/bench -v github.com/flanksource/duty/cmd/bench && \
./.bin/bench --count 250_000
go test -bench=. -benchmem -v github.com/flanksource/duty/cmd/bench

fmt:
go fmt ./...
Expand Down
98 changes: 31 additions & 67 deletions benchmark.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,79 +5,43 @@
query duration to fetch 10k, 25k, 50k and 100k config items in random are recorded.

```bash
# With RLS
go run main.go

# Without RLS
go run main.go --disable-rls
make bench
```

## Results

### Without RLS
### With RLS

```json
[
{
"config_count": 10000,
"duration": 766282108,
"rls_enabled": false
},
{
"config_count": 25000,
"duration": 1964247115,
"rls_enabled": false
},
{
"config_count": 50000,
"duration": 4738917435,
"rls_enabled": false
},
{
"config_count": 100000,
"duration": 7663285526,
"rls_enabled": false
}
]
```
goos: linux
goarch: amd64
pkg: github.com/flanksource/duty/cmd/bench
cpu: Intel(R) Core(TM) i9-14900K
BenchmarkFetchConfigNames
BenchmarkFetchConfigNames/FetchConfigNames-10000
BenchmarkFetchConfigNames/FetchConfigNames-10000-32 4 701321148 ns/op 69583090 B/op 1220178 allocs/op
BenchmarkFetchConfigNames/FetchConfigNames-25000
BenchmarkFetchConfigNames/FetchConfigNames-25000-32 2 1189989571 ns/op 174123684 B/op 3050480 allocs/op
BenchmarkFetchConfigNames/FetchConfigNames-50000
BenchmarkFetchConfigNames/FetchConfigNames-50000-32 1 1832064144 ns/op 348052240 B/op 6100887 allocs/op
BenchmarkFetchConfigNames/FetchConfigNames-100000
BenchmarkFetchConfigNames/FetchConfigNames-100000-32 1 3826969488 ns/op 696019648 B/op 12201860 allocs/op
```

| Configuration Count | Duration (s) |
| ------------------- | ------------ |
| 10,000 | 766.3 |
| 25,000 | 1.964 |
| 50,000 | 4.738 |
| 100,000 | 7.663 |

### With RLS
### Without RLS

```json
[
{
"config_count": 10000,
"duration": 897432497,
"rls_enabled": true
},
{
"config_count": 25000,
"duration": 1794868472,
"rls_enabled": true
},
{
"config_count": 50000,
"duration": 4383678988,
"rls_enabled": true
},
{
"config_count": 100000,
"duration": 7650471155,
"rls_enabled": true
}
]
```

| Configuration Count | Duration (s) |
| ------------------- | ------------ |
| 10,000 | 897.4 |
| 25,000 | 1.794 |
| 50,000 | 4.383 |
| 100,000 | 7.650 |
goos: linux
goarch: amd64
pkg: github.com/flanksource/duty/cmd/bench
cpu: Intel(R) Core(TM) i9-14900K
BenchmarkFetchConfigNames
BenchmarkFetchConfigNames/FetchConfigNames-10000
BenchmarkFetchConfigNames/FetchConfigNames-10000-32 3 361816087 ns/op 69498197 B/op 1220153 allocs/op
BenchmarkFetchConfigNames/FetchConfigNames-25000
BenchmarkFetchConfigNames/FetchConfigNames-25000-32 2 705966856 ns/op 174008556 B/op 3050453 allocs/op
BenchmarkFetchConfigNames/FetchConfigNames-50000
BenchmarkFetchConfigNames/FetchConfigNames-50000-32 1 2312185299 ns/op 348134392 B/op 6100975 allocs/op
BenchmarkFetchConfigNames/FetchConfigNames-100000
BenchmarkFetchConfigNames/FetchConfigNames-100000-32 1 3337049695 ns/op 696502376 B/op 12201872 allocs/op
```
Loading

0 comments on commit 028c615

Please sign in to comment.