HPCC-Platform icon indicating copy to clipboard operation
HPCC-Platform copied to clipboard

HPCC-31062 Include dfu file op cost in workunit aggregates

Open shamser opened this issue 11 months ago • 5 comments

Type of change:

  • [ ] This change is a bug fix (non-breaking change which fixes an issue).
  • [x] 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:

  • [x] My code follows the code style of this project.
    • [x] My code does not create any new warnings from compiler, build system, or lint.
  • [x] The commit message is properly formatted and free of typos.
    • [ ] The commit message title makes sense in a changelog, by itself.
    • [x] 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.
  • [x] I have read the CONTRIBUTORS document.
  • [x] 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 avatar Feb 29 '24 14:02 shamser

The following PRs must be merged before this one: https://github.com/hpcc-systems/HPCC-Platform/pull/18538 and https://github.com/hpcc-systems/HPCC-Platform/pull/18547 .

shamser avatar Apr 17 '24 12:04 shamser

@shamser - can you remind me why this isn't/can't be implemented via the StatisticsAggregator mechanism?

jakesmith avatar Apr 26 '24 13:04 jakesmith

@shamser - can you remind me why this isn't/can't be implemented via the StatisticsAggregator mechanism?

@jakesmith SSTdfuworkunit statistic is updated by fileservices plugin using CLocalWorkunit::setStatistic. To update the aggregates immediately within setStatistic, it would need to create an StatisticsAggregator object, load all of the existing statistics from global stats, mark the SSTdfuworkunit scope as "dirty", and then execute refreshAggregates to update the totals. The CStatisticCollection would need to be extended to support marking a scope as dirty. (This seems messy, slow and complicated compared to what is being done in this PR).

However, if this is not done with the expectation is that the statistic will be handled by future StatisticsAggregator, it won't be. The reason being is that there is nothing marking the SSTdfuworkunit scope as dirty and if the scope is not dirty then it wouldn't be used to calculate the aggregate.

shamser avatar Apr 29 '24 09:04 shamser

To update the aggregates immediately within setStatistic, it would need to create an StatisticsAggregator object, load all of the existing statistics from global stats

That is already happening though(?), but fileservices doesn't have access to the statsAggregator. i.e. fileservices is being called from a running workunit, which is loading all stats/calling StatisticsAggregator::updateAggregates periodically.

I think this approach is ok/pragmatic, but ideally, all stat settings would go through the aggregator that's active for the current workunit - with a similar approach to StatisticsAggregator::recordStats, which would mark dirty for a dfuscope (or arbitrary scope), and updates (to the workunit) would be a separate period task.

It would be good to add some notes into the code, to clarify why fileservices stats are not aggregated via the current workunit's StatisticsAggregator and what would have to change for that to be so, to make it clearer if this is revisited.

jakesmith avatar Apr 29 '24 11:04 jakesmith

The commit message has been updated to explain the change to setStatistic.

I believe the change to the filter depth is necessary. Please see comment: https://github.com/hpcc-systems/HPCC-Platform/pull/18358#discussion_r1593708627.

@ghalliday

shamser avatar May 08 '24 09:05 shamser