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-32483 Capture global sort/join blocked time #19181

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

Conversation

shamser
Copy link
Contributor

@shamser shamser commented Oct 3, 2024

Capture blocked time for global sort and joins.

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

github-actions bot commented Oct 3, 2024

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

Jirabot Action Result:
Workflow Transition To: Merge Pending
Updated PR

Capture blocked time for global sort and joins.

Signed-off-by: Shamser Ahmed <[email protected]>
@shamser shamser changed the base branch from candidate-9.8.x to master October 16, 2024 12:25
@shamser shamser marked this pull request as ready for review October 16, 2024 12:25
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 - please see comments.
It may be better to split this into individual activity PR changes.

@@ -299,7 +299,10 @@ class JoinSlaveActivity : public CSlaveActivity, implements ILookAheadStopNotify
stopOtherInput();
throw;
}
asyncSecondaryStart.wait();
{
BlockedActivityTimer t(slaveTimerStats, timeActivities);
Copy link
Member

Choose a reason for hiding this comment

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

not sure about this.

why is this blocked time?

input is on a thread - asynchronously starting.
Totalcycles at this point, will be the total time both took to start (overlapping).
The timing in queryLocalCycles() can go wrong because it is considering totalcycles - (input1-time+intput2-time), i.e. as if started synchronously.

This timer will be : input2 time - input1 time (or 0 if input2 was quicker).
Counting it as lookahead time, means "processCycles" in queryLocalCycles() will be total+this lookahead time, and mean that when the sum total for both inputs are deduced it should be correct.

Whatever the conclusion, needs a good comment here explaining the logic clearly.

@@ -387,7 +390,10 @@ class JoinSlaveActivity : public CSlaveActivity, implements ILookAheadStopNotify
{
unsigned bn=noSortPartitionSide()?2:4;
ActPrintLog("JOIN waiting barrier.%d",bn);
barrier->wait(false);
{
BlockedActivityTimer t(slaveTimerStats, timeActivities);
Copy link
Member

Choose a reason for hiding this comment

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

I realize there's BlockActivityTimer's in other stops already (via hash agg stream),

but .. stop() time in general is not being timed (as part of total cycles).. may be it should be - but that's a separate question.
So that means, if blocked time is, then processCycles could be < blockedCycles ( and result in warnings from queryLocalCycles)

If any act measures blocked in stop(), it would mean it needs to consider stop() in the calculation in general which it doesn't.
Can you remove this (and separately other Blocked time considerations in other stop'd contexts) and open a separate JIRA to revisit measuring time in general in activities stop()'s.

return false;
{
BlockedActivityTimer t(slaveTimerStats, timeActivities);
if (!barrier->wait(false))
Copy link
Member

Choose a reason for hiding this comment

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

what about the barrier->wait on line 613?

@@ -894,7 +895,10 @@ class CKeyedJoinSlave : public CSlaveActivity, implements IJoinProcessor, implem
void inc()
{
while (incNonBlocking())
{
BlockedActivityTimer t(activity.getTotalCyclesRef(), activity.queryTimeActivities());
Copy link
Member

Choose a reason for hiding this comment

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

is this block time actually holding up the nextRow (or start) of the KJ act?
If it's not and overlapping time, e.g. because full, but nextRow is not blocked, then it would be wrong to consider it "blocked" time.
The time we are trying to track is the time the totalcycles was blocked.

@@ -907,6 +911,7 @@ class CKeyedJoinSlave : public CSlaveActivity, implements IJoinProcessor, implem
}
void block()
{
BlockedActivityTimer t(activity.getTotalCyclesRef(), activity.queryTimeActivities());
Copy link
Member

Choose a reason for hiding this comment

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

same q. as per prev. comments.
Need to think carefully whether overlapping concurrent threads that are pending on something are blocking the acts start/nextrow from making progress.

@@ -1027,6 +1027,7 @@ class CInMemJoinBase : public CSlaveActivity, public CAllOrLookupHelper<HELPER>,
}
inline void interChannelBarrier()
{
BlockedActivityTimer t(slaveTimerStats, timeActivities);
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 it is generally corrected to consider this block time, because most are being called in the context (on the stack of) start/nextRow,
but there are a couple which are in the context of stop() [ see other comments re. not trackingstop() time ]

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