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-31511 Avoid keeping the workunit graphs in memory #18519

Merged
merged 1 commit into from
May 17, 2024

Conversation

richardkchapman
Copy link
Member

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:

Compiled

Copy link

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

Jirabot Action Result:
Workflow Transition: Merge Pending
Updated PR

@@ -42,6 +42,7 @@ include_directories (
./../../system/jlib
./../bindings/http/platform
./../../common/environment
./../../common/workunit
Copy link
Member

Choose a reason for hiding this comment

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

I would have expected a need to add workunit to the link libraries as well.

Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure why it builds without - probably because one of the libraries included already links to it. But I will add.

@@ -1788,5 +1788,6 @@ extern WORKUNIT_API void executeThorGraph(const char * graphName, IConstWorkUnit
extern WORKUNIT_API TraceFlags loadTraceFlags(IConstWorkUnit * wu, const std::initializer_list<TraceOption> & y, TraceFlags dft);

extern WORKUNIT_API bool executeGraphOnLingeringThor(IConstWorkUnit &workunit, unsigned wfid, const char *graphName);
extern WORKUNIT_API bool workunitGraphCacheEnabled;
Copy link
Member

Choose a reason for hiding this comment

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

I'm not a fan of exported variables. We tend to provide get()/set() functions everywhere else except for roxie. I may not care enough to avoid merging though.

Copy link
Member Author

Choose a reason for hiding this comment

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

If you can come up with a good reason, I don't mind changing. But there are plenty of other exported variables around...

Copy link
Member

Choose a reason for hiding this comment

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

There are very few, except for roxie. (E.g. I don't think there are any in this file.)
It generates slightly worse code (an extra indirect) - not significant in this case, but in general worth avoiding. (Thread local access code is much worse...)

@@ -393,6 +393,7 @@ int main( int argc, const char *argv[] )
#else
globals.setown(loadConfiguration(globals, argv, "thor", "THOR", nullptr, nullptr, nullptr, false));
#endif
workunitGraphCacheEnabled = globals->getPropBool("expert/@workunitGraphCacheEnabled", workunitGraphCacheEnabled);
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 is too early. (See the comment in the code below....)
I would expect a similar call in the thor master.

@jakesmith Does the slave load the graph from the workunit? Does it reload it for each subgraph?

Copy link
Member

Choose a reason for hiding this comment

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

Not per subgraph, but per Thor 'job' (i.e. each workflow graph)

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 is too early. (See the comment in the code below....)

yes, would be good to move within RegisterSelf next to similar expert tests,
and so that's bare-metal compatible, should use getExpertOptBool, i.e.:

Copy link
Member

Choose a reason for hiding this comment

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

I would expect a similar call in the thor master.

in master, a getExpertOptBool call should go in CJobManager::execute

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

@ghalliday ghalliday requested a review from jakesmith April 11, 2024 11:46
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.

@richardkchapman - please see additional comments re. Thor.

@@ -393,6 +393,7 @@ int main( int argc, const char *argv[] )
#else
globals.setown(loadConfiguration(globals, argv, "thor", "THOR", nullptr, nullptr, nullptr, false));
#endif
workunitGraphCacheEnabled = globals->getPropBool("expert/@workunitGraphCacheEnabled", workunitGraphCacheEnabled);
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 is too early. (See the comment in the code below....)

yes, would be good to move within RegisterSelf next to similar expert tests,
and so that's bare-metal compatible, should use getExpertOptBool, i.e.:

@@ -393,6 +393,7 @@ int main( int argc, const char *argv[] )
#else
globals.setown(loadConfiguration(globals, argv, "thor", "THOR", nullptr, nullptr, nullptr, false));
#endif
workunitGraphCacheEnabled = globals->getPropBool("expert/@workunitGraphCacheEnabled", workunitGraphCacheEnabled);
Copy link
Member

Choose a reason for hiding this comment

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

I would expect a similar call in the thor master.

in master, a getExpertOptBool call should go in CJobManager::execute

@ghalliday ghalliday requested review from ghalliday and jakesmith May 8, 2024 10:34
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.

@richardkchapman - looks good.

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.

I think ok to merge. remaining question is about the default. I would opt for default the same in 9.4 and on in 9.6 via a separate PR.

Please squash. Thanks.

@@ -1788,5 +1788,6 @@ extern WORKUNIT_API void executeThorGraph(const char * graphName, IConstWorkUnit
extern WORKUNIT_API TraceFlags loadTraceFlags(IConstWorkUnit * wu, const std::initializer_list<TraceOption> & y, TraceFlags dft);

extern WORKUNIT_API bool executeGraphOnLingeringThor(IConstWorkUnit &workunit, unsigned wfid, const char *graphName);
extern WORKUNIT_API bool workunitGraphCacheEnabled;
Copy link
Member

Choose a reason for hiding this comment

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

There are very few, except for roxie. (E.g. I don't think there are any in this file.)
It generates slightly worse code (an extra indirect) - not significant in this case, but in general worth avoiding. (Thread local access code is much worse...)

@@ -10411,8 +10411,11 @@ IPropertyTree * CLocalWUGraph::getXGMMLTreeRaw() const
return p->getPropTree("xgmml");
}

bool workunitGraphCacheEnabled = false;
Copy link
Member

Choose a reason for hiding this comment

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

Should this default on in 8.4 and then off in 9.6 to help reduce the potential for unexpected regressions. Then it could be tested on development system to verify the impact.

@richardkchapman
Copy link
Member Author

I have changed the default to be true in this PR that targets 9.4, and squashed. Once merged and upmerged I can do a new PR to change the default in 9.6

@ghalliday ghalliday merged commit bbd581d into hpcc-systems:candidate-9.4.x May 17, 2024
50 of 51 checks passed
@ghalliday
Copy link
Member

@mckellyln this option will be available in 9.4.x. It would be worth testing it on the development systems once this build is deployed to see what effect it has on memory usage and performance.

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