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-32241 Temp size for sort to use disk size and track actual graph temp disk usage #18883

Merged
merged 1 commit into from
Jul 18, 2024

Conversation

shamser
Copy link
Contributor

@shamser shamser commented Jul 16, 2024

SizePeakTempDisk for graphs was previous calculated by summing the each
activity's active temp file size. However, as this was done at internals,
spikes in temp file sizes between intervals were not recorded in the
SizePeakTempDisk stats. This change uses a TempFileSize tracker at the
graph level to track the actual peak/active temp file size for the graph.

Sort activities was using the size of the uncompressed data as the size
of the temp file. This change uses the actual size of temp file for sort
activity's peak/active temp file size

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:

Copy link

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

Jirabot Action Result:
Workflow Transition: Merge Pending
Updated PR

@shamser shamser changed the title HPCC-32241 Fix for SizePeakTempDisk sort and graph HPCC-32241 Fix SizePeakTempDisk sort and graphs Jul 16, 2024
@shamser shamser requested review from ghalliday and jakesmith July 16, 2024 13:49
@shamser shamser marked this pull request as ready for review July 16, 2024 13:49
@jakesmith
Copy link
Member

@shamser - could you update the commit message/PR message, to describe the what the problem was caused by/how it was fixed? It will aide the review process and future change history.

Copy link
Member

@jakesmith jakesmith left a comment

Choose a reason for hiding this comment

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

@shamser - could you update the commit message/PR message, to describe the what the problem was caused by/how it was fixed? It will aide the review process and future change history.

I think this has essentially change from recalculating the peak in serializeStats, to introducing a size tracker in the graph and pushing up the grow/shrink stat sto the subgraph.
That makes sense afaics (see comment re. child graphs).

Please update the commit message/PR message to contain a description of the bug, and how this addresses it.

@@ -1175,7 +1192,9 @@ class graph_decl CActivityBase : implements CInterfaceOf<IThorRowInterfaces>, im
CFileSizeTracker * queryTempFileSizeTracker()
{
if (!tempFileSizeTracker)
tempFileSizeTracker.setown(new CFileSizeTracker);
{
tempFileSizeTracker.setown(new CFileSizeTracker(queryGraph().queryTempFileSizeTracker()));
Copy link
Member

Choose a reason for hiding this comment

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

I think this needs to use queryGraph().queryParent(), because in a child query, queryGraph() will be the child graph, not the subgraph that's tracking the usage. queryGraph().queryParent(), should always point to the subgraph, no matter what the depth of the nested child graphs.

NB: note to self - CGraphBase::queryParent() and CGraphBase::queryOwner() are counter-intuitive, it would have made more sense if queryOwner() was the top-level graph (the subgraph) and queryOwner() was the activity containing graph (whether that be the subgraph, or a nested child graph).

Do you have a spilling child graph test, you can test this with?

Copy link
Member

Choose a reason for hiding this comment

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

I've attached loopsort2.ecl to the parent JIRA in case useful. It should spill in each iteration of the loop.
I've had a very brief look at the SizePeakTempDisk numbers:

sg1 (subgraph):
 <attr kind='SizePeakTempDisk' value='166813325' formatted='159.084MB' unit='sz' ctype='thor' creator='[email protected]' ts='2024-07-17T08:40:07.780Z'/>

sg5 (child loop graph):
 <attr kind='SizePeakTempDisk' value='132142234' formatted='126.020MB' unit='sz' ctype='thor' creator='[email protected]' ts='2024-07-17T08:40:07.780Z'/>

sg5:a7 (sort act in child graph)
 <attr kind='SizePeakTempDisk' value='29424207' formatted='28.060MB' unit='sz' ctype='thor' creator='[email protected]' ts='2024-07-17T08:40:07.780Z'/>

I think the numbers should be broadly the same, i.e. it's not clear why sg5's number is significantly higher.
NB: the loop result may also spill, but I don't think it's currently being tracked.

@shamser shamser requested a review from jakesmith July 17, 2024 10:50
Copy link
Member

@jakesmith jakesmith left a comment

Choose a reason for hiding this comment

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

@shamser Looks good.

#18883 (review)

commit/PR message needs updating.

@shamser shamser changed the title HPCC-32241 Fix SizePeakTempDisk sort and graphs HPCC-32241 Temp size for sort to use disk size and track actual graph temp disk usage Jul 17, 2024
@shamser shamser requested a review from jakesmith July 17, 2024 12:27
Copy link
Member

@jakesmith jakesmith left a comment

Choose a reason for hiding this comment

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

@shamser - looks good. Please squash, keeping the new commit message in the squashed commit and add it to the PR message.

temp disk usage

SizePeakTempDisk for graphs was previous calculated by summing the each
activity's active temp file size.  However, as this was done at internals,
spikes in temp file sizes between intervals were not recorded in the
SizePeakTempDisk stats.  This change uses a TempFileSize tracker at the
graph level to track the actual peak/active temp file size for the graph.

Sort activities was using the size of the uncompressed data as the size
of the temp file.  This change uses the actual size of temp file for sort
activity's peak/active temp file size

Signed-off-by: Shamser Ahmed <[email protected]>
@shamser
Copy link
Contributor Author

shamser commented Jul 18, 2024

SizePeakTempDisk for graphs was previous calculated by summing the each
activity's active temp file size. However, as this was done at internals,
spikes in temp file sizes between intervals were not recorded in the
SizePeakTempDisk stats. This change uses a TempFileSize tracker at the
graph level to track the actual peak/active temp file size for the graph.

Sort activities was using the size of the uncompressed data as the size
of the temp file. This change uses the actual size of temp file for sort
activity's peak/active temp file size

@shamser shamser requested a review from jakesmith July 18, 2024 08:48
@jakesmith
Copy link
Member

jakesmith commented Jul 18, 2024

@shamser - can you also copy the commit message in to this PR description, i.e. above the checkbox test (which is done automatically when pushing the 1st commit) ?

Done now. @jakesmith

Copy link
Member

@jakesmith jakesmith left a comment

Choose a reason for hiding this comment

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

@shamser - tagging you back re. #18883 (comment)

@shamser shamser requested a review from jakesmith July 18, 2024 10:14
Copy link
Member

@jakesmith jakesmith left a comment

Choose a reason for hiding this comment

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

@shamser - looks good

@ghalliday ghalliday merged commit 4a2ee9a into hpcc-systems:candidate-9.6.x Jul 18, 2024
49 checks passed
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.

3 participants