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

SOLR-17141: Create CpuQueryLimit implementation #2244

Merged
merged 21 commits into from
Feb 19, 2024

Conversation

sigram
Copy link
Contributor

@sigram sigram commented Feb 5, 2024

Details in Jira. This builds on top of changes in #2237.

Copy link
Contributor

@dsmiley dsmiley left a comment

Choose a reason for hiding this comment

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

Thanks for working on this. Seems useful reporting or API uses cases but maybe not for a SERP with a tight timeAllowed.

solr/core/src/java/org/apache/solr/search/QueryLimits.java Outdated Show resolved Hide resolved
import org.apache.solr.handler.component.ResponseBuilder;
import org.apache.solr.handler.component.SearchComponent;

public class ExpensiveSearchComponent extends SearchComponent {
Copy link
Contributor

Choose a reason for hiding this comment

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

Looking forward to seeing this on https://solr.cool/ :-)

Copy link
Contributor

@gus-asf gus-asf 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 the logging and limiting features are too tightly coupled still... It should be possible to set a timeout without logging the cpu time or vice-a-versa

@@ -622,8 +622,8 @@ public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throw
} while (nextStage != Integer.MAX_VALUE);

if (publishCpuTime) {
rsp.getResponseHeader().add(ThreadStats.CPU_TIME, totalShardCpuTime);
rsp.addToLog(ThreadStats.CPU_TIME, totalShardCpuTime);
rsp.getResponseHeader().add(ThreadCpuTime.CPU_TIME, totalShardCpuTime);
Copy link
Contributor

Choose a reason for hiding this comment

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

No null check here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you mean for the responseHeader?

* Improve the ExpensiveSearchComponent to produce consistent CPU load
* Use SolrJettyTestRule instead of full mini cloud cluster.
@github-actions github-actions bot added the documentation Improvements or additions to documentation label Feb 15, 2024
Copy link
Contributor

@dsmiley dsmiley left a comment

Choose a reason for hiding this comment

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

Nice work!

Clean up and document the ExpensiveSearchComponent. Support adding load at
different stages of distrib processing.
@sigram sigram requested a review from gus-asf February 16, 2024 10:38
@sigram sigram requested a review from dsmiley February 16, 2024 16:06
Copy link
Contributor

@dsmiley dsmiley left a comment

Choose a reason for hiding this comment

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

Overall looks good to me; I just have one small comment.

public static void setup() throws Exception {
System.setProperty(ThreadCpuTimer.ENABLE_CPU_TIME, "true");
Path configset = createConfigSet();
configureCluster(2).addConfig("conf", configset).configure();
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we actually need 2 nodes to test this? (Trying to keep tests as lean as needed to test what they need to test; no more)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Probably not at the moment... My thinking was that if/when we want to add more complex tests that trigger termination at various stages in the distrib processing then it's best to also include inter-node communication in the setup. We're not there yet so I can reduce it to 1 node.

Copy link
Contributor

@dsmiley dsmiley left a comment

Choose a reason for hiding this comment

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

I've found it to be very rare where we actually need more than one node to test functionality.

@sigram sigram merged commit 53a25d1 into apache:main Feb 19, 2024
4 checks passed
sigram added a commit to sigram/solr that referenced this pull request Feb 20, 2024
* Refactor to fix ThreadStats / ThreadCpuTime nesting and use it in CpuQueryTimeLimit.
* Rename classes to better reflect the type of limit.
sigram added a commit that referenced this pull request Feb 20, 2024
* SOLR-17141: Create CpuQueryLimit implementation (#2244)
* Refactor to fix ThreadStats / ThreadCpuTimer nesting and use it in CpuQueryTimeLimit.
* Rename classes to better reflect the type of limit.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cat:search client:solrj documentation Improvements or additions to documentation tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants