Skip to content

Commit

Permalink
/go/performance/utils/benchmark_runner: done refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
coffeegoddd committed Feb 14, 2024
1 parent ce21c0b commit d70b047
Show file tree
Hide file tree
Showing 40 changed files with 397 additions and 207 deletions.
48 changes: 24 additions & 24 deletions .github/workflows/ci-sysbench-runner-tests.yaml
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
name: Test Sysbench Runner Utility Works

on:
pull_request:
branches: [ main ]
paths:
- 'go/**'
- 'integration-tests/**'

concurrency:
group: ci-sysbench-runner-tests-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
mysql_client_integrations_job:
runs-on: ubuntu-22.04
name: Test Sysbench Runner
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Copy Dockerfile
run: cp -r ./go/performance/continuous_integration/. .
- name: Test sysbench runner
uses: ./.github/actions/sysbench-runner-tests
#name: Test Sysbench Runner Utility Works
#
#on:
# pull_request:
# branches: [ main ]
# paths:
# - 'go/**'
# - 'integration-tests/**'
#
#concurrency:
# group: ci-sysbench-runner-tests-${{ github.event.pull_request.number || github.ref }}
# cancel-in-progress: true
#
#jobs:
# mysql_client_integrations_job:
# runs-on: ubuntu-22.04
# name: Test Sysbench Runner
# steps:
# - name: Checkout
# uses: actions/checkout@v3
# - name: Copy Dockerfile
# run: cp -r ./go/performance/continuous_integration/. .
# - name: Test sysbench runner
# uses: ./.github/actions/sysbench-runner-tests
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
Sysbench runner is a tool for running sysbench tests against sql servers. Custom sysbench lua scripts used
for benchmarking Dolt are [here](https://github.com/dolthub/sysbench-lua-scripts).

The tool requires a json config file to run:
```bash
$ sysbench_runner --config=config.json
```

Configuration:

```json
Expand Down Expand Up @@ -62,8 +57,6 @@ oltp_update_non_index

`Port` is the server port. Defaults to **3306** for `dolt` and `mysql` Servers. (**Optional**)

`Server` is the server. Only `dolt` and `mysql` are supported. (**Required**)

`Version` is the server version. (**Required**)

`ResultsFormat` is the format the results should be written in. Only `json` and `csv` are supported. (**Required**)
Expand Down Expand Up @@ -105,12 +98,6 @@ Note: Be sure that all mysql processes are off when running this locally.
TPCC runner is a tool for running TPCC tests against sql servers. These tests run against the
Percona Labs repo [here](https://github.com/Percona-Lab/sysbench-tpcc).

The tool requires a json config file to run.

```bash
$ go run cmd/main.go --config=sample-tpcc-config.json
```

Note to this run this locally you need to have the TPCC repo cloned. The `ScriptDir` variable should then be linked
to the path of the cloned repo.

Expand Down
21 changes: 21 additions & 0 deletions go/performance/utils/benchmark_runner/benchmark.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright 2019-2022 Dolthub, Inc.
//
// Licensed 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.

package benchmark_runner

import "context"

type Benchmarker interface {
Benchmark(ctx context.Context) (Results, error)
}
39 changes: 39 additions & 0 deletions go/performance/utils/benchmark_runner/config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// Copyright 2019-2022 Dolthub, Inc.
//
// Licensed 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.

package benchmark_runner

import "context"

type Config interface {
GetRuns() int
GetScriptDir() string
GetNomsBinFormat() string
GetRuntimeOs() string
GetRuntimeGoArch() string
GetServerConfigs() []ServerConfig
Validate(ctx context.Context) error
ContainsServerOfType(server ServerType) bool
}

type SysbenchConfig interface {
Config
GetTestOptions() []string
GetTestConfigs() []TestConfig
}

type TpccConfig interface {
Config
GetScaleFactors() []int
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
package sysbench_runner
// Copyright 2019-2022 Dolthub, Inc.
//
// Licensed 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.

package benchmark_runner

import "time"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package sysbench_runner
package benchmark_runner

import (
"encoding/csv"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package sysbench_runner
package benchmark_runner

import (
"fmt"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package sysbench_runner
package benchmark_runner

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
package sysbench_runner
// Copyright 2019-2022 Dolthub, Inc.
//
// Licensed 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.

package benchmark_runner

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
package sysbench_runner
// Copyright 2019-2022 Dolthub, Inc.
//
// Licensed 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.

package benchmark_runner

import (
"fmt"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
package sysbench_runner
// Copyright 2019-2022 Dolthub, Inc.
//
// Licensed 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.

package benchmark_runner

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
package sysbench_runner
// Copyright 2019-2022 Dolthub, Inc.
//
// Licensed 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.

package benchmark_runner

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
package sysbench_runner
// Copyright 2019-2022 Dolthub, Inc.
//
// Licensed 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.

package benchmark_runner

import (
"fmt"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package sysbench_runner
package benchmark_runner

import (
"encoding/json"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package sysbench_runner
package benchmark_runner

import (
"fmt"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
package sysbench_runner
// Copyright 2019-2022 Dolthub, Inc.
//
// Licensed 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.

package benchmark_runner

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
package sysbench_runner
// Copyright 2019-2022 Dolthub, Inc.
//
// Licensed 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.

package benchmark_runner

import (
"fmt"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
package sysbench_runner
// Copyright 2019-2022 Dolthub, Inc.
//
// Licensed 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.

package benchmark_runner

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
package sysbench_runner
// Copyright 2019-2022 Dolthub, Inc.
//
// Licensed 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.

package benchmark_runner

import (
"context"
Expand Down
Loading

0 comments on commit d70b047

Please sign in to comment.