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
obj_bencher: status_printer waits before the first calculation #4151
Conversation
SUCCESS: the output of run-make-check.sh on centos-7 for e353307 is http://paste2.org/te1HtwXc |
Could you explain what you mean by that ? I would love to have the ideal solution ;-) |
If we look to the code, 'status_print' thread is created before we start write/read data to/from rados. So, in 'ideal solution' we have to notify the thread before (at the point when) we started write/read data (after notification the thread waits one measurement period (1sec) to collect statistic) and this point will be just after we create this thread, thus there is no any waiting. Notification mechanism causes complexity without profit in this case. |
@dachary Does my explanation make sense? What do you think? |
I think the correct fix for http://tracker.ceph.com/issues/7401 is --- a/src/common/obj_bencher.cc +++ b/src/common/obj_bencher.cc @@ -108,7 +108,7 @@ void *ObjBencher::status_printer(void *_bencher) { else bandwidth = 0; - if (!isnan(bandwidth)) { + if (cycleSinceChange && !isnan(bandwidth)) { if (bandwidth > data.idata.max_bandwidth) data.idata.max_bandwidth = bandwidth; if (bandwidth < data.idata.min_bandwidth) to skip the first cycle because bandwidth neads two measures to be computed. |
@dachary I have one concern:
|
@dmitryya it is better to not print the first line, indeed and the rest of the logic can remain the same. |
This will still store zero bandwidth in data history if writing an object takes more than one second (because data.finished - previous_writes will be zero at least once). |
Actually the correct patch is --- a/src/common/obj_bencher.cc +++ b/src/common/obj_bencher.cc @@ -108,7 +108,7 @@ void *ObjBencher::status_printer(void *_bencher) { else bandwidth = 0; - if (!isnan(bandwidth)) { + if (!isnan(bandwidth) && bandwidth > 0) { if (bandwidth > data.idata.max_bandwidth) data.idata.max_bandwidth = bandwidth; if (bandwidth < data.idata.min_bandwidth) because we never want to accumulate a bandwidth that is zero. A bandwidth of zero means that the object could not be written in one second (or that it's the first time in the loop). Even if writing an object takes a very long time, the bandwidth cannot be zero, it will just be very small. |
@dachary Yes, you are absolutely right - we do not need to accumulate a bandwidth that is zero - I missed this moment. Proposed patch looks good, but I still have one concern about I told before: in my opinion, we do not need printing status line when cycleSinceChange is 0 (first line) - because it confuses. There are several approaches for that:
|
@dmitryya could you please rebase ? |
We never want to accumulate a bandwidth that is zero. A bandwidth of zero means that the object could not be written in one second (or that it's the first time in the loop). Even if writing an object takes a very long time, the bandwidth cannot be zero, it will just be very small. Fix suggested by @dachary Fixes: #7401 Signed-off-by: Dmitry Yatsushkevich <dmitry.yatsushkevich@gmail.com>
obj_bencher: status_printer waits before the first calculation Reviewed-by: Loic Dachary <ldachary@redhat.com>
@dmitryya merged this because it's useful on its own. Would you be so kind as to propose another pull request addressing the points you mentioned in your last comment ? |
@dachary yes, sure. |
Fix for issue http://tracker.ceph.com/issues/7401
Cause of the issue: ObjBencher::status_printer calculates first step metrics before a bench test run.
Now, ObjBencher::status_printer waits one measurement period before starting calculating metrics.
Note: the ideal mechanism for such situation is: main thread notify the status thread when a test is started -> after that the status thread waits a measurement period and calculates first values. But this is redundantly here.