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

HPCC-31650 Address incorrect analyzer cost calculations and cost threshold #19360

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

shamser
Copy link
Contributor

@shamser shamser commented Dec 13, 2024

  • The rate used to calculate the cost of issues has been updated so that the unit is consistent and produces valid cost calculation.
  • 'minInterestingCost' is a decimal value to set the minimum dollar cost value for reported issues.
  • 'minInterestingCost' is compared with the calculated cost of the issue
  • 'minInterestingWaste' is a new option to set the minimum time threshold for reported issues.

Type of change:

  • This change is a bug fix (non-breaking change which fixes an issue).
  • This change is a new feature (non-breaking change which adds functionality).
  • This change improves the code (refactor or other change that does not change the functionality)
  • This change fixes warnings (the fix does not alter the functionality or the generated code)
  • This change is a breaking change (fix or feature that will cause existing behavior to change).
  • This change alters the query API (existing queries will have to be recompiled)

Checklist:

  • My code follows the code style of this project.
    • My code does not create any new warnings from compiler, build system, or lint.
  • The commit message is properly formatted and free of typos.
    • The commit message title makes sense in a changelog, by itself.
    • The commit is signed.
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly, or...
    • I have created a JIRA ticket to update the documentation.
    • Any new interfaces or exported functions are appropriately commented.
  • I have read the CONTRIBUTORS document.
  • The change has been fully tested:
    • I have added tests to cover my changes.
    • All new and existing tests passed.
    • I have checked that this change does not introduce memory leaks.
    • I have used Valgrind or similar tools to check for potential issues.
  • I have given due consideration to all of the following potential concerns:
    • Scalability
    • Performance
    • Security
    • Thread-safety
    • Cloud-compatibility
    • Premature optimization
    • Existing deployed queries will not be broken
    • This change fixes the problem, not just the symptom
    • The target branch of this pull request is appropriate for such a change.
  • There are no similar instances of the same problem that should be addressed
    • I have addressed them here
    • I have raised JIRA issues to address them separately
  • This is a user interface / front-end modification
    • I have tested my changes in multiple modern browsers
    • The component(s) render as expected

Smoketest:

  • Send notifications about my Pull Request position in Smoketest queue.
  • Test my draft Pull Request.

Testing:

@shamser shamser force-pushed the issue31650 branch 2 times, most recently from d605198 to 215ac70 Compare December 13, 2024 12:03
@shamser shamser requested a review from ghalliday December 13, 2024 12:06
@ghalliday
Copy link
Member

The title does not reference a jira, so I can't check the scope of the PR.

@shamser shamser changed the title Address incorrect analyzer cost calculations and cost threshold HPCC-31650 Address incorrect analyzer cost calculations and cost threshold Dec 20, 2024
@shamser
Copy link
Contributor Author

shamser commented Dec 20, 2024

The title does not reference a jira, so I can't check the scope of the PR.

Sorry, fixed. @ghalliday

Copy link

github-actions bot commented Jan 2, 2025

Jira Issue: https://hpccsystems.atlassian.net//browse/HPCC-31650

Jirabot Action Result:
Workflow Transition To: Merge Pending

Copy link
Member

@ghalliday ghalliday left a comment

Choose a reason for hiding this comment

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

It looks like I forgot to submit this comments - sorry

@@ -21,6 +21,13 @@
#include "anarule.hpp"
#include "commonext.hpp"


static cost_type calcCost(stat_type timePenalty, const stat_type clusterCostPerHour)
Copy link
Member

Choose a reason for hiding this comment

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

For consistency with the other global calc cost function this should probably swap the parameters


static cost_type calcCost(stat_type timePenalty, const stat_type clusterCostPerHour)
{
double timePenaltyPerHour = (double)statUnits2seconds(timePenalty) / 3600;
Copy link
Member

Choose a reason for hiding this comment

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

minor: statsUnits2seconds should probably return a double
picky: timePenaltyHours rather than PerHour

@@ -71,10 +72,11 @@ struct WuOption

constexpr struct WuOption wuOptionsDefaults[watOptMax]
= { {watOptMinInterestingTime, "minInterestingTime", 1000, wutOptValueTypeMSec},
{watOptMinInterestingCost, "minInterestingCost", 30000, wutOptValueTypeMSec},
{watOptMinInterestingCost, "minInterestingCost", money2cost_type(5.0) /* $5 */, wutOptValueTypeCost},
Copy link
Member

Choose a reason for hiding this comment

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

$5 is quite a lot. That is probably 15-30 minutes on many of our clusters - compared to the previous threshold of 30s. What is the reason for this change? Should there be thresholds for cost and timing?

Copy link
Contributor Author

@shamser shamser Jan 3, 2025

Choose a reason for hiding this comment

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

We didn't have a $ threshold before, so I chose an arbitrary value. I can change it to a lower value. Do you think this threshold should be $0.10?

It made sense to only have time-penalty based cost when that was all we had. However, after renaming to "Cost Optimizer", it seemed sensible to also have the options in terms of costs.

It would be simple enough to introduce a minInterestingTimePenalty (is there a better name for this?).

If we have both minInterestingCost and minInterestingTimePenalty, should the issue be reported if either condition is met or should both conditions have to be met?

I was also thinking to ignore the minInterestingCost option if the cluster rate is 0.00. Is that sensible? The reason is that if the cpu rates aren't provided, then all issues will fail to meet the threshould and so would be ignored.

@ghalliday

Copy link
Member

Choose a reason for hiding this comment

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

My thoughts:
I think it would be worth discussing with tony kirk and/or chad to see what they would consider interesting.

Cost is definitely interesting - I suspect any waste over $1 is worth noting. However if you are running on hthor, or a small 20way cluster, then delays of 30s or may also be interesting. Again, I would defer to Tony and Chad for the thresholds they are interested in. Maybe there should be some colour coding in eclwatch to highlight anything over a $1.

I suspect it would be worth having two options - not sure of the best name for the time maybe minInterestingWaste? I doubt these have ever been overridden so feel free to rename them. Either option should be ignored if they are 0, and the error is reported if either condition is true. If you had the time and cost thresholds then you would still report even if the calculated cost was 0.

@shamser shamser force-pushed the issue31650 branch 2 times, most recently from 3055bf3 to 3fc3049 Compare January 3, 2025 16:40
@shamser shamser requested a review from ghalliday January 3, 2025 16:44
Copy link
Member

@ghalliday ghalliday left a comment

Choose a reason for hiding this comment

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

Looks good to me, please squash

@shamser shamser force-pushed the issue31650 branch 2 times, most recently from a9aff72 to 3b3c4c7 Compare January 9, 2025 10:43
* The rate used to calculate the cost of issues has been updated so
that the unit is consistent and produces valid cost calculation.
* 'minInterestingCost' is a decimal value to set the minimum dollar
cost value for reported issues.
* 'minInterestingCost' is compared with the calculated cost of the
issue
*  'minInterestingWaste' is a new option to set the minimum time
threshold for reported issues.

Signed-off-by: Shamser Ahmed <[email protected]>
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.

2 participants