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

obj_bencher: status_printer waits before the first calculation #4151

Merged
1 commit merged into from May 13, 2015
Merged

obj_bencher: status_printer waits before the first calculation #4151

1 commit merged into from May 13, 2015

Conversation

dmitryya
Copy link

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.

@dmitryya dmitryya changed the title obj_bencher: status_printer waits before the first calc obj_bencher: status_printer waits before the first calculation Mar 23, 2015
@loic-bot
Copy link

SUCCESS: the output of run-make-check.sh on centos-7 for e353307 is http://paste2.org/te1HtwXc

:octocat: Sent from GH.

@ghost
Copy link

ghost commented Mar 24, 2015

But this is redundantly here.

Could you explain what you mean by that ? I would love to have the ideal solution ;-)

@ghost ghost self-assigned this Mar 24, 2015
@ghost ghost added bug-fix core labels Mar 24, 2015
@dmitryya
Copy link
Author

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.

@ldachary ldachary assigned ldachary and unassigned ghost Mar 25, 2015
@dmitryya
Copy link
Author

@dachary Does my explanation make sense? What do you think?

@ghost
Copy link

ghost commented Mar 28, 2015

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.

@ghost ghost self-assigned this Mar 28, 2015
@dmitryya
Copy link
Author

@dachary I have one concern:

  • useless and unnecessary line with all zero will be printed (and other useless operation will be made such us avg bandwidth calculation) at the first step:
    
    sec Cur ops   started  finished  avg MB/s  cur MB/s  last lat   avg lat
      0       0         0         0         0         0         -         0
    
    In my point of view, step with all zeros has to be skipped to do not confuse.

@ghost
Copy link

ghost commented Apr 2, 2015

@dmitryya it is better to not print the first line, indeed and the rest of the logic can remain the same.

@ghost ghost mentioned this pull request Apr 9, 2015
@ghost
Copy link

ghost commented Apr 9, 2015

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).

@ghost
Copy link

ghost commented Apr 9, 2015

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.

@dmitryya
Copy link
Author

dmitryya commented Apr 9, 2015

@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.
For this reason I proposed moved printing status code into if (cycleSinceChange) { ... } block.
The first loop in status_printing is useless, because bench is not started yet, for this reason, I think, we have to skip it.

There are several approaches for that:

  • move code into if (cycleSinceChange) { ... }
  • wait measurement period before while(!data.done) { ... } or move waiting from the end loop to beginning - in these cases we can made a small optimisation and remove if (cycleSinceChange) { ... } block as useless (minus one conditional branch which checks every time in loop - it is not so bad)

@liewegas liewegas added tools and removed core labels Apr 14, 2015
@ghost
Copy link

ghost commented Apr 29, 2015

@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>
ghost pushed a commit that referenced this pull request May 13, 2015
obj_bencher: status_printer waits before the first calculation

Reviewed-by: Loic Dachary <ldachary@redhat.com>
@ghost ghost merged commit 180ed33 into ceph:master May 13, 2015
@ghost
Copy link

ghost commented May 13, 2015

@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 ?

@dmitryya
Copy link
Author

@dachary yes, sure.

@dmitryya dmitryya deleted the issue_7401 branch May 13, 2015 18:05
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants