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

add mixgraph benchmark #286

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ log
.idea
.vscode
vendor
tool/tool
.DS_Store
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.18.4-alpine3.16
FROM golang:1.13.6-alpine3.11

ENV GOPATH /go

Expand Down
24 changes: 4 additions & 20 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,32 +1,16 @@
FDB_CHECK := $(shell command -v fdbcli 2> /dev/null)
ROCKSDB_CHECK := $(shell echo "int main() { return 0; }" | gcc -lrocksdb -x c++ -o /dev/null - 2>/dev/null; echo $$?)
SQLITE_CHECK := $(shell echo "int main() { return 0; }" | gcc -lsqlite3 -x c++ -o /dev/null - 2>/dev/null; echo $$?)

TAGS =
TAGS =

ifdef FDB_CHECK
TAGS += foundationdb
endif

ifneq ($(shell go env GOOS), $(shell go env GOHOSTOS))
CROSS_COMPILE := 1
endif
ifneq ($(shell go env GOARCH), $(shell go env GOHOSTARCH))
CROSS_COMPILE := 1
endif

ifndef CROSS_COMPILE

ifeq ($(SQLITE_CHECK), 0)
TAGS += libsqlite3
endif
endif

ifeq ($(ROCKSDB_CHECK), 0)
TAGS += rocksdb
CGO_CXXFLAGS := "${CGO_CXXFLAGS} -std=c++11"
CGO_FLAGS += CGO_CXXFLAGS=$(CGO_CXXFLAGS)
endif

CGO_CXXFLAGS := "${CGO_CXXFLAGS} -std=c++11"
CGO_FLAGS += CGO_CXXFLAGS=$(CGO_CXXFLAGS)
endif

default: build
Expand Down
102 changes: 17 additions & 85 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# go-ycsb
# go-ycsb

go-ycsb is a Go port of [YCSB](https://github.com/brianfrankcooper/YCSB). It fully supports all YCSB generators and the Core workload so we can do the basic CRUD benchmarks with Go.

Expand All @@ -9,46 +9,22 @@ go-ycsb is a Go port of [YCSB](https://github.com/brianfrankcooper/YCSB). It ful

## Getting Started

### Download

https://github.com/pingcap/go-ycsb/releases/latest

**Linux**
```
wget -c https://github.com/pingcap/go-ycsb/releases/latest/download/go-ycsb-linux-amd64.tar.gz -O - | tar -xz

# give it a try
./go-ycsb --help
```

**OSX**
```
wget -c https://github.com/pingcap/go-ycsb/releases/latest/download/go-ycsb-darwin-amd64.tar.gz -O - | tar -xz

# give it a try
./go-ycsb --help
```

### Building from source

```bash
git clone https://github.com/pingcap/go-ycsb.git
cd go-ycsb
git clone https://github.com/pingcap/go-ycsb.git $GOPATH/src/github.com/pingcap/go-ycsb
cd $GOPATH/src/github.com/pingcap/go-ycsb
make

# give it a try
./bin/go-ycsb --help
./bin/go-ycsb
```

Notice:

+ Minimum supported go version is 1.16.
+ To use FoundationDB, you must install [client](https://www.foundationdb.org/download/) library at first, now the supported version is 6.2.11.
+ To use RocksDB, you must follow [INSTALL](https://github.com/facebook/rocksdb/blob/master/INSTALL.md) to install RocksDB at first.

## Usage
## Usage

Mostly, we can start from the official document [Running-a-Workload](https://github.com/brianfrankcooper/YCSB/wiki/Running-a-Workload).
Mostly, we can start from the offical document [Running-a-Workload](https://github.com/brianfrankcooper/YCSB/wiki/Running-a-Workload).

### Shell

Expand Down Expand Up @@ -86,31 +62,22 @@ Available Commands:

- MySQL / TiDB
- TiKV
- FoundationDB
- FoundationDB
- Aerospike
- Badger
- Cassandra / ScyllaDB
- Pegasus
- PostgreSQL / CockroachDB / AlloyDB / Yugabyte
- PostgreSQL / CockroachDB
- RocksDB
- Spanner
- Sqlite
- MongoDB
- Redis and Redis Cluster
- BoltDB
- etcd
- DynamoDB

## Output configuration

|field|default value|description|
|-|-|-|
|measurementtype|"histogram"|The mechanism for recording measurements, one of `histogram`, `raw` or `csv`|
|measurement.output_file|""|File to write output to, default writes to stdout|

## Database Configuration

You can pass the database configurations through `-p field=value` in the command line directly.
You can pass the database configuraitons through `-p field=value` in the command line directly.

Common configurations:

Expand All @@ -120,7 +87,7 @@ Common configurations:
|verbose|false|Output the execution query|
|debug.pprof|":6060"|Go debug profile address|

### MySQL & TiDB
### MySQL

|field|default value|description|
|-|-|-|
Expand All @@ -129,8 +96,6 @@ Common configurations:
|mysql.user|"root"|MySQL User|
|mysql.password||MySQL Password|
|mysql.db|"test"|MySQL Database|
|tidb.cluster_index|true|Whether to use cluster index, for TiDB only|
|tidb.instances|""|Comma-seperated address list of tidb instances (eg: `tidb-0:4000,tidb-1:4000`)|


### TiKV
Expand All @@ -141,9 +106,7 @@ Common configurations:
|tikv.type|"raw"|TiKV mode, "raw", "txn", or "coprocessor"|
|tikv.conncount|128|gRPC connection count|
|tikv.batchsize|128|Request batch size|
|tikv.async_commit|true|Enalbe async commit or not|
|tikv.one_pc|true|Enable one phase or not|
|tikv.apiversion|"V1"|[api-version](https://docs.pingcap.com/tidb/stable/tikv-configuration-file#api-version-new-in-v610) of tikv server, "V1" or "V2"|


### FoundationDB

Expand All @@ -153,14 +116,14 @@ Common configurations:
|fdb.dbname|"DB"|The cluster database name|
|fdb.apiversion|510|API version, now only 5.1 is supported|

### PostgreSQL & CockroachDB & AlloyDB & Yugabyte
### PostgreSQL

|field|default value|description|
|-|-|-|
|pg.host|"127.0.0.1"|PostgreSQL Host|
|pg.port|5432|PostgreSQL Port|
|pg.user|"root"|PostgreSQL User|
|pg.password||PostgreSQL Password|
|pg.passowrd||PostgreSQL Password|
|pg.db|"test"|PostgreSQL Database|
|pg.sslmode|"disable|PostgreSQL ssl mode|

Expand Down Expand Up @@ -230,7 +193,7 @@ Common configurations:
|rocksdb.index_type|kBinarySearch|Sets the index type used for this table. __kBinarySearch__: A space efficient index block that is optimized for binary-search-based index. __kHashSearch__: The hash index, if enabled, will do the hash lookup when `Options.prefix_extractor` is provided. __kTwoLevelIndexSearch__: A two-level index implementation. Both levels are binary search indexes|
|rocksdb.block_align|false|Enable/Disable align data blocks on lesser of page size and block size|

### Spanner
### Spanner

|field|default value|description|
|-|-|-|
Expand All @@ -246,23 +209,19 @@ Common configurations:
|sqlite.journalmode|"DELETE"|Journal mode: DELETE, TRUNCSTE, PERSIST, MEMORY, WAL, OFF|
|sqlite.cache|"Shared"|Cache: shared, private|

### Cassandra
### Cassandra

|field|default value|description|
|-|-|-|
|cassandra.cluster|"127.0.0.1:9042"|Cassandra cluster|
|cassandra.keyspace|"test"|Keyspace|
|cassandra.connections|2|Number of connections per host|
|cassandra.username|cassandra|Username|
|cassandra.password|cassandra|Password|

### MongoDB

|field|default value|description|
|-|-|-|
|mongodb.url|"mongodb://127.0.0.1:27017"|MongoDB URI|
|mongodb.tls_skip_verify|false|Enable/disable server ca certificate verification|
|mongodb.tls_ca_file|""|Path to mongodb server ca certificate file|
|mongodb.uri|"mongodb://127.0.0.1:27017"|MongoDB URI|
|mongodb.namespace|"ycsb.ycsb"|Namespace to use|
|mongodb.authdb|"admin"|Authentication database|
|mongodb.username|N/A|Username for authentication|
Expand All @@ -271,7 +230,6 @@ Common configurations:
### Redis
|field|default value|description|
|-|-|-|
|redis.datatype|hash|"hash", "string" or "json" ("json" requires [RedisJSON](https://redis.io/docs/stack/json/) available)|
|redis.mode|single|"single" or "cluster"|
|redis.network|tcp|"tcp" or "unix"|
|redis.addr||Redis server address(es) in "host:port" form, can be semi-colon `;` separated in cluster mode|
Expand All @@ -286,7 +244,7 @@ Common configurations:
|redis.max_retry_backoff|512ms|Maximum backoff between each retry|
|redis.dial_timeout|5s|Dial timeout for establishing new connection|
|redis.read_timeout|3s|Timeout for socket reads|
|redis.write_timeout|3s|Timeout for socket writes|
|redis.write_timeout|3s|Timeout for socker writes|
|redis.pool_size|10|Maximum number of socket connections|
|redis.min_idle_conns|0|Minimum number of idle connections|
|redis.max_conn_age|0|Connection age at which client closes the connection|
Expand All @@ -309,32 +267,6 @@ Common configurations:
|bolt.mmap_flags|0|Set the DB.MmapFlags flag before memory mapping the file|
|bolt.initial_mmap_size|0|The initial mmap size of the database in bytes. If <= 0, the initial map size is 0. If the size is smaller than the previous database, it takes no effect|

### etcd

|field|default value|description|
|-|-|-|
|etcd.endpoints|"localhost:2379"|The etcd endpoint(s), multiple endpoints can be passed separated by comma.|
|etcd.dial_timeout|"2s"|The dial timeout duration passed into the client config.|
|etcd.cert_file|""|When using secure etcd, this should point to the crt file.|
|etcd.key_file|""|When using secure etcd, this should point to the pem file.|
|etcd.cacert_file|""|When using secure etcd, this should point to the ca file.|

### DynamoDB

|field|default value|description|
|-|-|-|
|dynamodb.tablename|"ycsb"|The database tablename|
|dynamodb.primarykey|"_key"|The table primary key fieldname|
|dynamodb.rc.units|10|Read request units throughput|
|dynamodb.wc.units|10|Write request units throughput|
|dynamodb.ensure.clean.table|true|On load mode ensure that the table is clean at the begining. In case of true and if the table previously exists it will be deleted and recreated|
|dynamodb.endpoint|""|Used endpoint for connection. If empty will use the default loaded configs|
|dynamodb.region|""|Used region for connection ( should match endpoint ). If empty will use the default loaded configs|
|dynamodb.consistent.reads|false|Reads on DynamoDB provide an eventually consistent read by default. If your benchmark/use-case requires a strongly consistent read, set this option to true|
|dynamodb.delete.after.run.stage|false|Detele the database table after the run stage|



## TODO

- [ ] Support more measurement, like HdrHistogram
Expand Down
7 changes: 3 additions & 4 deletions cmd/go-ycsb/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"github.com/spf13/cobra"
)

func runClientCommandFunc(cmd *cobra.Command, args []string, doTransactions bool, command string) {
func runClientCommandFunc(cmd *cobra.Command, args []string, doTransactions bool) {
dbName := args[0]

initialGlobal(dbName, func() {
Expand All @@ -33,7 +33,6 @@ func runClientCommandFunc(cmd *cobra.Command, args []string, doTransactions bool
doTransFlag = "false"
}
globalProps.Set(prop.DoTransactions, doTransFlag)
globalProps.Set(prop.Command, command)

if cmd.Flags().Changed("threads") {
// We set the threadArg via command line.
Expand Down Expand Up @@ -64,11 +63,11 @@ func runClientCommandFunc(cmd *cobra.Command, args []string, doTransactions bool
}

func runLoadCommandFunc(cmd *cobra.Command, args []string) {
runClientCommandFunc(cmd, args, false, "load")
runClientCommandFunc(cmd, args, false)
}

func runTransCommandFunc(cmd *cobra.Command, args []string) {
runClientCommandFunc(cmd, args, true, "run")
runClientCommandFunc(cmd, args, true)
}

var (
Expand Down
20 changes: 20 additions & 0 deletions cmd/go-ycsb/fdb.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright 2018 PingCAP, 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,
// See the License for the specific language governing permissions and
// limitations under the License.

// +build foundationdb

package main

import ( // Register FoundationDB database
_ "github.com/pingcap/go-ycsb/db/foundationdb"
)
20 changes: 6 additions & 14 deletions cmd/go-ycsb/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ package main

import (
"context"
"fmt"
"log"
"net/http"
_ "net/http/pprof"
"os"
Expand All @@ -29,14 +27,17 @@ import (

// Register workload

"github.com/spf13/cobra"
"fmt"

"github.com/pingcap/go-ycsb/pkg/client"
"github.com/pingcap/go-ycsb/pkg/measurement"
"github.com/pingcap/go-ycsb/pkg/prop"
"github.com/pingcap/go-ycsb/pkg/util"
_ "github.com/pingcap/go-ycsb/pkg/workload"
"github.com/pingcap/go-ycsb/pkg/ycsb"
"github.com/spf13/cobra"

log "github.com/sirupsen/logrus"

// Register basic database
_ "github.com/pingcap/go-ycsb/db/basic"
Expand All @@ -50,8 +51,6 @@ import (
_ "github.com/pingcap/go-ycsb/db/aerospike"
// Register Badger database
_ "github.com/pingcap/go-ycsb/db/badger"
// Register FoundationDB database
_ "github.com/pingcap/go-ycsb/db/foundationdb"
// Register RocksDB database
_ "github.com/pingcap/go-ycsb/db/rocksdb"
// Register Spanner database
Expand All @@ -70,12 +69,6 @@ import (
_ "github.com/pingcap/go-ycsb/db/boltdb"
// Register minio
_ "github.com/pingcap/go-ycsb/db/minio"
// Register elastic
_ "github.com/pingcap/go-ycsb/db/elasticsearch"
// Register etcd
_ "github.com/pingcap/go-ycsb/db/etcd"
// Register dynamodb
_ "github.com/pingcap/go-ycsb/db/dynamodb"
)

var (
Expand All @@ -93,16 +86,15 @@ var (
)

func initialGlobal(dbName string, onProperties func()) {
log.SetLevel(log.WarnLevel)

globalProps = properties.NewProperties()
if len(propertyFiles) > 0 {
globalProps = properties.MustLoadFiles(propertyFiles, properties.UTF8, false)
}

for _, prop := range propertyValues {
seps := strings.SplitN(prop, "=", 2)
if len(seps) != 2 {
log.Fatalf("bad property: `%s`, expected format `name=value`", prop)
}
globalProps.Set(seps[0], seps[1])
}

Expand Down
Loading