Skip to content

Commit

Permalink
workload/ycsb: add flag to use column families
Browse files Browse the repository at this point in the history
This change adds a new `--families` flag to the ycsb workload. Now
that cockroachdb#18168 is addressed, this significantly reduces the contention
present in the workload by avoiding conflicts on updates to different
columns in the same table.

Release note: None
  • Loading branch information
nvanbenschoten committed Nov 29, 2018
1 parent 0b95ad3 commit 16ffee3
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion pkg/workload/ycsb/ycsb.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,30 @@ const (
FIELD8 TEXT,
FIELD9 TEXT
)`
usertableSchemaRelationalWithFamilies = `(
ycsb_key VARCHAR(255) PRIMARY KEY NOT NULL,
FIELD0 TEXT,
FIELD1 TEXT,
FIELD2 TEXT,
FIELD3 TEXT,
FIELD4 TEXT,
FIELD5 TEXT,
FIELD6 TEXT,
FIELD7 TEXT,
FIELD8 TEXT,
FIELD9 TEXT,
FAMILY (ycsb_key),
FAMILY (FIELD0),
FAMILY (FIELD1),
FAMILY (FIELD2),
FAMILY (FIELD3),
FAMILY (FIELD4),
FAMILY (FIELD5),
FAMILY (FIELD6),
FAMILY (FIELD7),
FAMILY (FIELD8),
FAMILY (FIELD9)
)`
usertableSchemaJSON = `(
ycsb_key VARCHAR(255) PRIMARY KEY NOT NULL,
FIELD JSONB
Expand All @@ -64,6 +88,7 @@ type ycsb struct {
seed int64
initialRows int
json bool
families bool
splits int

workload string
Expand All @@ -89,6 +114,7 @@ var ycsbMeta = workload.Meta{
g.flags.IntVar(&g.initialRows, `initial-rows`, 10000,
`Initial number of rows to sequentially insert before beginning Zipfian workload`)
g.flags.BoolVar(&g.json, `json`, false, `Use JSONB rather than relational data`)
g.flags.BoolVar(&g.families, `families`, true, `Place each column in its own column family`)
g.flags.IntVar(&g.splits, `splits`, 0, `Number of splits to perform before starting normal operations`)
g.flags.StringVar(&g.workload, `workload`, `B`, `Workload type. Choose from A-F.`)
g.flags.StringVar(&g.distribution, `request-distribution`, `zipfian`, `Distribution for random number generator [zipfian, uniform].`)
Expand Down Expand Up @@ -169,7 +195,11 @@ func (g *ycsb) Tables() []workload.Table {
if g.json {
usertable.Schema = usertableSchemaJSON
} else {
usertable.Schema = usertableSchemaRelational
if g.families {
usertable.Schema = usertableSchemaRelationalWithFamilies
} else {
usertable.Schema = usertableSchemaRelational
}
}
return []workload.Table{usertable}
}
Expand Down

0 comments on commit 16ffee3

Please sign in to comment.