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-31545 Thread pool wait time reporting #18475

Merged
merged 1 commit into from
Apr 5, 2024

Conversation

mckellyln
Copy link
Contributor

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-31545

Jirabot Action Result:
Workflow Transition: Merge Pending
Updated PR
Assigning user: [email protected]

@@ -1017,13 +1026,11 @@ class CThreadPool: public CThreadPoolBase, implements IThreadPool, public CInter
throw MakeStringException(0, "No threads available in pool %s", poolname.get());
IWARNLOG("Pool limit exceeded for %s", poolname.get());
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This code continues on with a new thread even when it timed out waiting for a free slot (when timeout == 0)
Is that what we want ? Should it instead wait 'forever' for a free slot when timeout == 0 ?

Copy link
Member

Choose a reason for hiding this comment

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

if parameter 'timeout' is 0 (and noBlock=false), then it will have waited for 'delay' ms.
I think it's correct/by design, to have waited for 'delay' ms, then continue in that case.

Copy link
Member

Choose a reason for hiding this comment

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

trivial/formatting/not new: line 1024 is only line formatted without brace on newline, would be good to change so consistent with rest of function

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.

@mckellyln - looks good, can be merged as is. A couple of minor comments.

@@ -1017,13 +1026,11 @@ class CThreadPool: public CThreadPoolBase, implements IThreadPool, public CInter
throw MakeStringException(0, "No threads available in pool %s", poolname.get());
IWARNLOG("Pool limit exceeded for %s", poolname.get());
Copy link
Member

Choose a reason for hiding this comment

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

if parameter 'timeout' is 0 (and noBlock=false), then it will have waited for 'delay' ms.
I think it's correct/by design, to have waited for 'delay' ms, then continue in that case.

@@ -1017,13 +1026,11 @@ class CThreadPool: public CThreadPoolBase, implements IThreadPool, public CInter
throw MakeStringException(0, "No threads available in pool %s", poolname.get());
IWARNLOG("Pool limit exceeded for %s", poolname.get());
Copy link
Member

Choose a reason for hiding this comment

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

trivial/formatting/not new: line 1024 is only line formatted without brace on newline, would be good to change so consistent with rest of function

}
if (traceStartDelayPeriod)
{
++startsInPeriod;
if (timedout)
if (waited)
Copy link
Member

Choose a reason for hiding this comment

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

Don't think it really matters, but if there's an accumulate delay, but as it crosses the 1 minute mark (the 'traceStartDelayPeriod' period), 'waited' isn't true, then it won't report until the next delayed thread.

Perhaps change to:

            if (traceStartDelayPeriod)
            {
                ++startsInPeriod;
                if (waited)
                    startDelayInPeriod += startTimer.elapsedCycles();
                if (startDelayInPeriod && (overAllTimer.elapsedCycles() >= queryOneSecCycles()*traceStartDelayPeriod)) // check avg. delay per minute
                {
....
                }
            }

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree, good find. I would even say tho I want to know how many threads started even if there is no accumulated delay, so I don't think we need the extra check of if(startDelayInPeriod) to log the info. See commit 2.

@@ -1185,7 +1185,7 @@ class CKJService : public CSimpleInterfaceOf<IKJService>, implements IThreaded,
{
Owned<CProcessorFactory> factory = new CProcessorFactory(*this);
processorPool.setown(createThreadPool("KJService processor pool", factory, this, keyLookupMaxProcessThreads, 10000));
processorPool->setStartDelayTracing(60000);
processorPool->setStartDelayTracing(60);
Copy link
Member

Choose a reason for hiding this comment

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

whoops, good change!
Perhaps we should just default it to 60seconds in CThreadPool ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure if you want I can change default.

@mckellyln mckellyln requested a review from jakesmith April 3, 2024 13:57
@mckellyln
Copy link
Contributor Author

@jakesmith made those changes and am requesting a quick re-review, thanks.

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.

Changes look good to me

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.

@mckellyln - looks good. Please squash.

@mckellyln
Copy link
Contributor Author

mckellyln commented Apr 5, 2024

Squashed, should be good to merge.

@ghalliday ghalliday merged commit 4f7b613 into hpcc-systems:candidate-9.4.x Apr 5, 2024
45 of 46 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