mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-05 08:10:50 +00:00
bspawn can create and tear down cluster for benchmarks
This commit is contained in:
parent
d3714729ac
commit
069484ab0e
4 changed files with 33 additions and 9 deletions
|
|
@ -1225,14 +1225,27 @@ The following flags are allowed:
|
|||
`)
|
||||
}
|
||||
|
||||
// Run executes the main program execution.
|
||||
// create separates creation from running for use programmatically by other
|
||||
// commands like bspawn.
|
||||
func (cmd *CreateCommand) create() (creator.Cluster, error) {
|
||||
switch cmd.Type {
|
||||
case "local":
|
||||
return creator.NewLocalCluster(cmd.ReplicaN, cmd.ServerN)
|
||||
case "AWS":
|
||||
return nil, fmt.Errorf("unimplemented create type: %v", cmd.Type)
|
||||
default:
|
||||
return nil, fmt.Errorf("unsupported create type: %v", cmd.Type)
|
||||
}
|
||||
}
|
||||
|
||||
// Run executes cluster creation.
|
||||
func (cmd *CreateCommand) Run() error {
|
||||
var clus creator.Cluster
|
||||
switch cmd.Type {
|
||||
case "local":
|
||||
var err error
|
||||
if cmd.run {
|
||||
clus, err = creator.NewLocalCluster(cmd.ReplicaN, cmd.ServerN)
|
||||
clus, err = cmd.create()
|
||||
if err != nil {
|
||||
return fmt.Errorf("running create command: %v", err)
|
||||
}
|
||||
|
|
@ -1436,7 +1449,7 @@ func (cmd *BspawnCommand) ParseFlags(args []string) error {
|
|||
// Usage returns the usage message to be printed.
|
||||
func (cmd *BspawnCommand) Usage() string {
|
||||
return strings.TrimSpace(`
|
||||
pilosactl bspaw is a tool for running multiple instances of bagent against a cluster.
|
||||
pilosactl bspawn is a tool for running multiple instances of bagent against a cluster.
|
||||
|
||||
Usage:
|
||||
|
||||
|
|
@ -1446,6 +1459,17 @@ pilosactl spawn configfile
|
|||
|
||||
// Run executes the main program execution.
|
||||
func (cmd *BspawnCommand) Run() error {
|
||||
if len(cmd.PilosaHosts) == 0 {
|
||||
// must create cluster
|
||||
createCmd := NewCreateCommand(cmd.Stdin, cmd.Stdout, cmd.Stderr)
|
||||
createCmd.ParseFlags(cmd.CreatorArgs)
|
||||
clus, err := createCmd.create()
|
||||
if err != nil {
|
||||
return fmt.Errorf("Cluster creation error while spawning: %v", err)
|
||||
}
|
||||
defer clus.Shutdown()
|
||||
cmd.PilosaHosts = clus.Hosts()
|
||||
}
|
||||
switch cmd.Agents.Type {
|
||||
case "local":
|
||||
return cmd.spawnLocal()
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
{
|
||||
"PilosaHosts": ["localhost:19327","localhost:19328","localhost:19329"],
|
||||
"CreatorArgs": ["-type", "local", "-serverN", "3", "-replicaN", "1"],
|
||||
"Agents": { "Type": "local" },
|
||||
"Benchmarks": [
|
||||
{
|
||||
"Num": 3,
|
||||
"Args": ["MultiDBSetBits", "-Iterations", "100000", "-ClientType", "round_robin"]
|
||||
"Args": ["MultiDBSetBits", "-Iterations", "30000", "-ClientType", "round_robin"]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
{
|
||||
"PilosaHosts": ["localhost:19327","localhost:19328","localhost:19329"],
|
||||
"CreatorArgs": ["-type", "local", "-serverN", "3", "-replicaN", "1"],
|
||||
"Agents": { "Type": "local" },
|
||||
"Benchmarks": [
|
||||
{
|
||||
"Num": 3,
|
||||
"Args": ["RandomSetBits", "-Iterations", "10000", "-ProfileIDRange", "1000000", "-BitmapIDRange", "1000000", "-Seed", "2345", "-ClientType", "round_robin"]
|
||||
"Args": ["RandomSetBits", "-Iterations", "30000", "-ProfileIDRange", "1000000", "-BitmapIDRange", "1000000", "-Seed", "2345", "-ClientType", "round_robin"]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
{
|
||||
"PilosaHosts": ["localhost:19327","localhost:19328","localhost:19329"],
|
||||
"CreatorArgs": ["-type", "local", "-serverN", "3", "-replicaN", "1"],
|
||||
"Agents": { "Type": "local" },
|
||||
"Benchmarks": [
|
||||
{
|
||||
"Num": 3,
|
||||
"Args": ["DiagonalSetBits", "-Iterations", "100000", "-ClientType", "round_robin"]
|
||||
"Args": ["DiagonalSetBits", "-Iterations", "30000", "-ClientType", "round_robin"]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue