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

pre-run prefix to object keys #4

Merged
merged 1 commit into from
Jul 14, 2022
Merged
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
14 changes: 13 additions & 1 deletion src/sibench/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import "github.com/docopt/docopt-go"
import "fmt"
import "logger"
import "math"
import "math/rand"
import "os"
import "regexp"
import "strings"
Expand Down Expand Up @@ -324,6 +325,15 @@ func startServer(args *Arguments) {
}



/* Creates a random string which we can use to guarantee uniqueness across runs. */
func createUniquePrefix() string {
source := rand.NewSource(time.Now().UnixNano())
prng := rand.New(source)
return fmt.Sprintf("sibench-%X", prng.Uint64())
}


/* Create a job and execute it on some set of servers. */
func startRun(args *Arguments) {
var j Job
Expand All @@ -338,6 +348,7 @@ func startRun(args *Arguments) {
j.useBytes = args.UseBytes

j.order.JobId = 1
j.order.ObjectKeyPrefix = createUniquePrefix()
j.order.ObjectSize = args.ObjectSizeInBits
j.order.Seed = uint64(time.Now().Unix())
j.order.RangeStart = 0
Expand Down Expand Up @@ -394,7 +405,8 @@ func startRun(args *Arguments) {
"username": args.CephUser,
"key": args.CephKey,
"pool": args.CephPool,
"datapool": args.CephDatapool }
"datapool": args.CephDatapool,
"image_prefix": createUniquePrefix() }

case args.Block:
j.order.ConnectionType = "block"
Expand Down
1 change: 1 addition & 0 deletions src/sibench/messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ type WorkOrder struct {
ReadWriteMix uint64 // Give the percentage of reads vs writes for combined ops.

// Object parameters
ObjectKeyPrefix string // A random prefix to be used for object keys to ensure uniqueness across runs
ObjectSize uint64 // The size of the objects we read and write
Seed uint64 // A seed for any PRNGs in use.
GeneratorType string // Which type of Generator we will use to create and verify object data.
Expand Down
2 changes: 1 addition & 1 deletion src/sibench/rbd_connecton.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func (conn *RbdConnection) WorkerConnect() error {
// use. The connection protocol map know how much data we will be managing.

imageSize := uint64((conn.worker.WorkerRangeEnd - conn.worker.WorkerRangeStart) * conn.worker.ObjectSize)
imageName := fmt.Sprintf("sibench-%v-%v", conn.worker.Hostname, conn.worker.WorkerId)
imageName := fmt.Sprintf("%v-%v-%v", conn.protocol["image_prefix"], conn.worker.Hostname, conn.worker.WorkerId)
imageOrder := uint64(22) // 1 << 22 gives a 4MB object size

options := rbd.NewRbdImageOptions()
Expand Down
4 changes: 2 additions & 2 deletions src/sibench/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ func (w *Worker) connect() {


func (w *Worker) writeOrPrepare(phase StatPhase) {
key := fmt.Sprintf("obj_%v", w.objectIndex)
key := fmt.Sprintf("%v-%v", w.order.ObjectKeyPrefix, w.objectIndex)
contents := w.generator.Generate(w.order.ObjectSize, key, w.cycle)
conn := w.connections[w.connIndex]

Expand Down Expand Up @@ -350,7 +350,7 @@ func (w *Worker) prepare() {
func (w *Worker) read() {
w.limitBandwidth()

key := fmt.Sprintf("obj_%v", w.objectIndex)
key := fmt.Sprintf("%v-%v", w.order.ObjectKeyPrefix, w.objectIndex)
conn := w.connections[w.connIndex]

var err error
Expand Down