Skip to content

Commit

Permalink
objbench: adjust the time for deleting objects (#5264)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhijian-pro authored Oct 31, 2024
1 parent acd2484 commit 30ab60e
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions cmd/objbench.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,11 +253,6 @@ func objbench(ctx *cli.Context) error {
count: bCount,
title: "download objects",
startKey: sCount,
after: func(blob object.ObjectStorage) {
for i := sCount; i < sCount+bCount; i++ {
_ = blob.Delete(strconv.Itoa(i))
}
},
getResult: func(cost float64) []string {
line := []string{"", nspt, nspt}
if cost > 0 {
Expand All @@ -274,7 +269,7 @@ func objbench(ctx *cli.Context) error {
getResult: func(cost float64) []string {
line := []string{"", nspt, nspt}
if cost > 0 {
line[1], line[2] = colorize("list", float64(sCount)*100/cost, float64(threads)*cost*10, 2, colorful)
line[1], line[2] = colorize("list", float64(sCount+bCount)*100/cost, float64(threads)*cost*10, 2, colorful)
line[1] += " objects/s"
line[2] += " ms/op"
}
Expand Down Expand Up @@ -334,12 +329,12 @@ func objbench(ctx *cli.Context) error {
},
}, {
name: "delete",
count: sCount,
count: sCount + bCount,
title: "delete objects",
getResult: func(cost float64) []string {
line := []string{"", nspt, nspt}
if cost > 0 {
line[1], line[2] = colorize("delete", float64(sCount)/cost, float64(threads)*cost*1000/float64(sCount), 1, colorful)
line[1], line[2] = colorize("delete", float64(sCount+bCount)/cost, float64(threads)*cost*1000/float64(sCount), 1, colorful)
line[1] += " objects/s"
line[2] += " ms/object"
}
Expand Down Expand Up @@ -435,7 +430,6 @@ type apiInfo struct {
count int
startKey int
getResult func(cost float64) []string
after func(blob object.ObjectStorage)
}

type benchMarkObj struct {
Expand Down Expand Up @@ -485,9 +479,6 @@ func (bm *benchMarkObj) run(api apiInfo) []string {
var wg sync.WaitGroup
pool := make(chan struct{}, bm.threads)
count := api.count
if api.count != 0 {
count = api.count
}
bar := bm.progressBar.AddCountBar(api.title, int64(count))
var err error
start := time.Now()
Expand All @@ -508,9 +499,6 @@ func (bm *benchMarkObj) run(api apiInfo) []string {
wg.Wait()
bar.Done()
line := api.getResult(time.Since(start).Seconds())
if api.after != nil {
api.after(bm.blob)
}
if err != nil {
logger.Errorf("%s test failed: %s", api.name, err)
return []string{api.title, failed, failed}
Expand Down

0 comments on commit 30ab60e

Please sign in to comment.