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

bf: S3C-1427 use expired interval to average out throughput #268

Merged

Conversation

philipyoo
Copy link
Contributor

When an interval of data in Redis expires, throughput will
abruptly reduce. Given the data we collect, we can only
calculate the average throughput. To ease the erratic
decrease on expiration of an interval, instead, get the
average of elapsed time for the newest interval and
remaining time of the interval multiplied against the
average of the just-expired interval.

In Redis, we need to save an extra interval to reference
the just-expired data.

@philipyoo
Copy link
Contributor Author

Also, this should not be added to master. Instead, changes should be added to Arsenal master branch with support for multiple sites

dora-korpar
dora-korpar previously approved these changes Apr 24, 2018
Copy link
Contributor

@jonathan-gramain jonathan-gramain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Architecturally I think the backbeat API server is not the right place to do computation to return averages, etc. because it has only minimal info available to do this computation. We can think about how to do the integration with Prometheus later and how to just expose the needed raw stats, so that all the derived values are mashed by Prometheus itself.

This being said, in the short term since it improves the currently exposed stats I think we should keep this change anyway, left some comments though.

const lastInterval =
this._statsClient._normalizeTimestamp(new Date(now));
// in seconds
const diff = Math.floor((now - lastInterval) / 1000);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the Math.floor needed? Can't we just keep the original sub-second precision we have?

// Get average for last interval depending on time surpassed
// so far for newest interval
total +=
Math.floor(((INTERVAL - diff) / INTERVAL) * r.requests[3]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same about Math.floor


// Get average for last interval depending on time surpassed
// so far for newest interval
total +=
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could condition this line to timeSinceStart >= EXPIRY and always return (total / EXPIRY).toFixed(2)

When an interval of data in Redis expires, throughput will
abruptly reduce. Given the data we collect, we can only
calculate the average throughput. To ease the erratic
decrease on expiration of an interval, instead, get the
average of elapsed time for the newest interval and
remaining time of the interval multiplied against the
average of the just-expired interval.

In Redis, we need to save an extra interval to reference
the just-expired data.
@philipyoo philipyoo force-pushed the bf/S3C-1427-avgThroughputBetweenExpiredIntervals branch from 05906a2 to 18fb8b8 Compare April 25, 2018 00:44
@ironman-machine ironman-machine dismissed dora-korpar’s stale review April 25, 2018 00:44

Do it again human slave!:point_right: :runner: (Oh and the pull request has been updated, by the way.)

@ironman-machine
Copy link
Contributor

PR has been updated. Reviewers, please be cautious.

@philipyoo
Copy link
Contributor Author

Yup, I think prometheus has a lot to offer in terms of functionality as well, so should be a good refactor for crr metrics, and possibly metrics for other extensions in backbeat 👍

@jonathan-gramain
Copy link
Contributor

@ironman-machine
RUN_BACKBEAT_CRR_TESTS=1
r+

@ironman-machine
Copy link
Contributor

Hello @jonathan-gramain

"RUN_BACKBEAT_CRR_TESTS=1": Success
"r+": Success

@ironman-machine
Copy link
Contributor

⌛ PR is now pending. CI build url: http://ci.ironmann.io/gh/scality/Integration/21575

@philipyoo
Copy link
Contributor Author

@ironman-machine
RUN_BACKBEAT_CRR_TESTS=1
try

@ironman-machine
Copy link
Contributor

Hello @philipyoo

"RUN_BACKBEAT_CRR_TESTS=1": Success
"try": Success: Try build successfully launched on 'http://ci.ironmann.io/gh/scality/Integration/21589' with the following env. args:

{
    "RUN_BACKBEAT_CRR_TESTS": "1",
    "DEFAULT_BRANCH": "rel/7.4",
    "SCALITY_INTEGRATION_BRANCH": "ultron/rel/7.4",
    "REPO_NAME": "backbeat",
    "SCALITY_BACKBEAT_BRANCH": "bf/S3C-1427-avgThroughputBetweenExpiredIntervals"
}

@ironman-machine
Copy link
Contributor

💔 ☔ circleCI test failed.

@philipyoo
Copy link
Contributor Author

@ironman-machine
RUN_BACKBEAT_CRR_TESTS=1
try

@ironman-machine
Copy link
Contributor

Hello @philipyoo

"RUN_BACKBEAT_CRR_TESTS=1": Success
"try": Success: Try build successfully launched on 'http://ci.ironmann.io/gh/scality/Integration/21591' with the following env. args:

{
    "RUN_BACKBEAT_CRR_TESTS": "1",
    "DEFAULT_BRANCH": "rel/7.4",
    "SCALITY_INTEGRATION_BRANCH": "ultron/rel/7.4",
    "REPO_NAME": "backbeat",
    "SCALITY_BACKBEAT_BRANCH": "bf/S3C-1427-avgThroughputBetweenExpiredIntervals"
}

@jonathan-gramain
Copy link
Contributor

Integration succeeded in http://ci.ironmann.io/gh/scality/Integration/21601

@jonathan-gramain
Copy link
Contributor

@ironman-machine r-

@ironman-machine
Copy link
Contributor

Hello @jonathan-gramain

"r-": Success

@jonathan-gramain jonathan-gramain merged commit ac21e19 into rel/7.4 Apr 25, 2018
@jonathan-gramain jonathan-gramain deleted the bf/S3C-1427-avgThroughputBetweenExpiredIntervals branch April 25, 2018 21:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants