Skip to content

Commit

Permalink
unify format
Browse files Browse the repository at this point in the history
Signed-off-by: husharp <jinhao.hu@pingcap.com>
  • Loading branch information
HuSharp committed Dec 29, 2023
1 parent 491a859 commit c5f2cb6
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 41 deletions.
5 changes: 3 additions & 2 deletions tools/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ module github.com/tikv/pd/tools

go 1.21

replace google.golang.org/grpc v1.59.0 => google.golang.org/grpc v1.26.0

replace (
github.com/tikv/pd => ../
github.com/tikv/pd/client => ../client
)

// reset grpc and protobuf deps in order to import client and server at the same time
replace google.golang.org/grpc v1.59.0 => google.golang.org/grpc v1.26.0

require (
github.com/BurntSushi/toml v0.3.1
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e
Expand Down
47 changes: 25 additions & 22 deletions tools/pd-api-bench/README.md
Original file line number Diff line number Diff line change
@@ -1,67 +1,70 @@
pd-api-bench
========
# pd-api-bench

pd-api-bench is a tool to test PD API.

## Build

1. [Go](https://golang.org/) Version 1.21 or later
2. In the root directory of the [PD project](https://github.com/tikv/pd), use the `make pd-api-bench` command to compile and generate `bin/pd-api-bench`


## Usage

This section describes how to use the `pd-api-bench` tool.

### Cases

The api bench cases we support are as follows:

1. HTTP
+ GetRegionStatus: /pd/api/v1/stats/region
+ GetMinResolvedTS: /pd/api/v1/min-resolved-ts

+ GetRegionStatus: /pd/api/v1/stats/region
+ GetMinResolvedTS: /pd/api/v1/min-resolved-ts

2. gRPC
+ GetRegion
+ GetStore
+ GetStores
+ ScanRegions

+ GetRegion
+ GetStore
+ GetStores
+ ScanRegions

### Flags description

-cacert string
> path of file that contains list of trusted SSL CAs
> path of file that contains list of trusted SSL CAs
-cert string
> path of file that contains X509 certificate in PEM format
> path of file that contains X509 certificate in PEM format
-key string
> path of file that contains X509 key in PEM format
> path of file that contains X509 key in PEM format
-client int
> the client number (default 1)
> the client number (default 1)
-pd string
> pd address (default "127.0.0.1:2379")
> pd address (default "127.0.0.1:2379")
-http-cases
> HTTP api bench cases list. Multiple cases are separated by commas. Such as `-http-cases GetRegionStatus,GetMinResolvedTS`
> You can set qps with '-' and set burst with '+' such as `-http-cases GetRegionStatus-100+1`
> HTTP api bench cases list. Multiple cases are separated by commas. Such as `-http-cases GetRegionStatus,GetMinResolvedTS`
> You can set qps with '-' and set burst with '+' such as `-http-cases GetRegionStatus-100+1`
-grpc-cases
> gRPC api bench cases list. Multiple cases are separated by commas. Such as `-grpc-cases GetRegion`
> You can set qps with '-' and set burst with '+' such as `-grpc-cases GetRegion-1000000+10`
> gRPC api bench cases list. Multiple cases are separated by commas. Such as `-grpc-cases GetRegion`
> You can set qps with '-' and set burst with '+' such as `-grpc-cases GetRegion-1000000+10`
-qps
> the qps of request (default 1000). It will set qps for all cases except those in which qps is specified separately
-qps
> the qps of request (default 1000). It will set qps for all cases except those in which qps is specified separately
-burst
> the burst of request (default 1). It will set burst for all cases except those in which burst is specified separately
> the burst of request (default 1). It will set burst for all cases except those in which burst is specified separately
-debug
> print the output of api response for debug
> print the output of api response for debug
### Run Shell

You can run shell as follows.

```shell
go run main.go -http-cases GetRegionStatus-1+1,GetMinResolvedTS-1+1 -client 1 -debug true
```
Expand Down
2 changes: 1 addition & 1 deletion tools/pd-recover/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

## Build

1. [Go](https://golang.org/) Version 1.16 or later
1. [Go](https://golang.org/) Version 1.21 or later
2. In the root directory of the [PD project](https://github.com/tikv/pd), use the `make pd-recover` command to compile and generate `bin/pd-recover`.

## Usage
Expand Down
23 changes: 14 additions & 9 deletions tools/pd-simulator/README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
pd-simulator
========
# pd-simulator

pd-simulator is a tool to reproduce some scenarios and evaluate the schedulers' efficiency.

## Build
1. [Go](https://golang.org/) Version 1.9 or later
2. In the root directory of the [PD project](https://github.com/tikv/pd), use the `make simulator` command to compile and generate `bin/pd-simulator`

1. [Go](https://golang.org/) Version 1.21 or later
2. In the root directory of the [PD project](https://github.com/tikv/pd), use the `make simulator` command to compile and generate `bin/pd-simulator`

## Usage

This section describes how to use the simulator.

### Flags description
### Flags Description

```
```shell
-pd string
Specify a PD address (if this parameter is not set, it will start a PD server from the simulator inside)
-config string
Expand All @@ -29,12 +28,18 @@ This section describes how to use the simulator.
Run all cases:
./pd-simulator
```shell
./pd-simulator
```
Run a specific case with an internal PD:
./pd-simulator -case="casename"
```shell
./pd-simulator -case="casename"
```
Run a specific case with an external PD:
./pd-simulator -pd="http://127.0.0.1:2379" -case="casename"
```shell
./pd-simulator -pd="http://127.0.0.1:2379" -case="casename"
```
15 changes: 8 additions & 7 deletions tools/pd-tso-bench/README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
pd-tso-bench
========
# pd-tso-bench

pd-tso-bench is a tool to benchmark GetTS performance.

## Build
1. [Go](https://golang.org/) Version 1.9 or later
2. In the root directory of the [PD project](https://github.com/tikv/pd), use the `make` command to compile and generate `bin/pd-tso-bench`

1. [Go](https://golang.org/) Version 1.21 or later
2. In the root directory of the [PD project](https://github.com/tikv/pd), use the `make` command to compile and generate `bin/pd-tso-bench`

## Usage

This section describes how to benchmark the GetTS performance.

### Flags description

```
```shell
-c int
concurrency (default 1000)
-cacert string
Expand All @@ -35,12 +34,14 @@ This section describes how to benchmark the GetTS performance.
path of file that contains X509 key in PEM format
-pd string
pd address (default "127.0.0.1:2379")
-v output statistics info every interval and output metrics info at the end
-v output statistics info every interval and output metrics info at the end
```

Benchmark the GetTS performance:

```shell
./pd-tso-bench -v -duration 5s
```

It will print some benchmark results like:

Expand All @@ -56,4 +57,4 @@ count:482854, max:9, min:0, >1ms:277221, >2ms:162617, >5ms:15097, >10ms:0, >30ms
Total:
count:4059056, max:9, min:0, >1ms:2519515, >2ms:213266, >5ms:16839, >10ms:0, >30ms:0 >50ms:0 >100ms:0 >200ms:0 >400ms:0 >800ms:0 >1s:0
count:4059056, >1ms:62.07%, >2ms:5.25%, >5ms:0.41%, >10ms:0.00%, >30ms:0.00% >50ms:0.00% >100ms:0.00% >200ms:0.00% >400ms:0.00% >800ms:0.00% >1s:0.00%
```
```

0 comments on commit c5f2cb6

Please sign in to comment.