-
Notifications
You must be signed in to change notification settings - Fork 9.8k
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
Tools: new benchmark for the hashkv performance #9866
Conversation
@gyuho hi, I tried it on a db file size around ~8GB and that's the output the new command provides,
Hope it makes sense? The command will provide a way for any user to check the hashkv performance in their own environment. |
this is more a benchmark than a check. for a check, we should provide a criteria, and output failure or success. |
Codecov Report
@@ Coverage Diff @@
## master #9866 +/- ##
==========================================
+ Coverage 69.1% 69.19% +0.09%
==========================================
Files 385 385
Lines 35703 35703
==========================================
+ Hits 24672 24706 +34
+ Misses 9228 9198 -30
+ Partials 1803 1799 -4
Continue to review full report at Codecov.
|
3f112b5
to
5338419
Compare
@spzala Yes! subcommand in benchmark is better. I will take a look at this PR this week. Thanks! |
@gyuho sounds great. Thanks much!! |
@spzala On second thought, instead of duplicating code for key writes, how about adding a flag |
@gyuho initially I thought of moving some of write code into benchmark util method but wasn't sure if that could have make sense. Adding a sub-command sounds good, let me try it and will update the code. Thanks! |
tools/benchmark/cmd/put.go
Outdated
if errhash != nil { | ||
fmt.Fprintf(os.Stderr, "Failed to get the hashkv of endpoint %s (%v)\n", host, errhash) | ||
panic(err) | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not need else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup, makes sense..not needed.
tools/benchmark/cmd/put.go
Outdated
if errstatus != nil { | ||
fmt.Println(fmt.Fprintf(os.Stderr, "Failed to get the status of endpoint %s (%v)\n", host, errstatus)) | ||
panic(err) | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not need else?
@spzala Overall looks great. Could you fix CI and provide some sample outputs with GBs of data? Thanks a lot! |
@gyuho thanks much, will be updating output example shortly. |
@gyuho made a minor change in the latest commit in how output is being displayed (db size in GB vs MB I had in previous commit). Here are few related examples output,
|
tools/benchmark/cmd/put.go
Outdated
ctx, cancel := context.WithCancel(context.Background()) | ||
clients[0].HashKV(ctx, eps[0], epHashKVRev) | ||
if !strings.HasPrefix(eps[0], `http://`) { | ||
host = "http://" + eps[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gyuho hi, I thought we check it by convention. It's not needed as you pointed out. I will remove it. Thanks!
tools/benchmark/cmd/put.go
Outdated
} | ||
dbsize := float64(respstatus.DbSize) / (1000 * 1000 * 1000) | ||
results += fmt.Sprintf(" DB size: %vGB \t\n", strconv.FormatFloat(dbsize, 'f', 2, 64)) | ||
fmt.Println(results) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@spzala Let's use humanize.Bytes
to string-ify db size. Then, this should be good to merge. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gyuho thanks, this's good to know. Will make changes.
Can you also comment this result #9866 (comment) on |
tools/benchmark/cmd/put.go
Outdated
fmt.Println(fmt.Fprintf(os.Stderr, "Failed to get the status of endpoint %s (%v)\n", host, errstatus)) | ||
panic(err) | ||
} | ||
results += fmt.Sprintf(" DB size: %v \t\n", humanize.Bytes(uint64(respstatus.DbSize))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just " DB size: %s"
?
tools/benchmark/cmd/put.go
Outdated
|
||
// Get the db size | ||
if errstatus != nil { | ||
fmt.Println(fmt.Fprintf(os.Stderr, "Failed to get the status of endpoint %s (%v)\n", host, errstatus)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just do fmt.Printf("...\n")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, thanks @gyuho!
tools/benchmark/cmd/put.go
Outdated
panic(err) | ||
} | ||
results += fmt.Sprintf("\nHaskKV Summary:\n") | ||
results += fmt.Sprintf(" HashKV: %v \t\n", resphash.Hash) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/ \t\n"/\n"
to all? We just need \n
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gyuho my bad, yes we don't need tab. Thanks!!
The benchmark as a sub command of put when provided will fetch hashkv and checks the time taken to get it. Fixed # 8910 Provider a way to etcd user to check how long it takes to get hashkv in user enviornment. The command ouput will provide time taken to get hashkv along with db file size.
Signed-off-by: Gyuho Lee <[email protected]>
Provider a way to etcd users to check how long it takes to get
hashkv in user enviornment. The command output will provide time taken
to get hashkv along with db file size.
Fixed #8910