Skip to content

Conversation

@nik9000
Copy link
Member

@nik9000 nik9000 commented Jul 25, 2025

Speeds up the spec tests by:

  • Randomize async/sync instead of both
  • Check the took time rarely
  • Don't check if index exists every time
  • Reduce transfer when checking breaker
  • Cache capabilities checks

The first one is most of the speed up but the rest save another couple of minutes. Time drops from 13m45s to 6m or so on my laptop.

Speeds up the spec tests by:
* Randomize `async`/`sync` instead of both
* Check the took time rarely
* Don't check if index exists every time
* Reduce transfer when checking breaker
* Cache capabilities checks

The first one is most of the speed up but the rest save another couple
of minutes. Time drops from 13m45s to 6m or so on my laptop.
@nik9000 nik9000 added >test Issues or PRs that are addressing/adding tests :Analytics/ES|QL AKA ESQL v9.2.0 labels Jul 25, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-analytical-engine (Team:Analytics)

@elasticsearchmachine elasticsearchmachine added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label Jul 25, 2025
protected static boolean oldClusterHasFeature(String featureId) {
assert oldClusterTestFeatureService != null;
return oldClusterTestFeatureService.clusterHasFeature(featureId);
}
Copy link
Member Author

Choose a reason for hiding this comment

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

Unused.

return true;
}

@Before
Copy link
Member Author

Choose a reason for hiding this comment

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

Saves some time at the cost of some paranoia.

public static void assertRequestBreakerEmpty() throws Exception {
assertBusy(() -> {
HttpEntity entity = adminClient().performRequest(new Request("GET", "/_nodes/stats")).getEntity();
HttpEntity entity = adminClient().performRequest(new Request("GET", "/_nodes/stats?metric=breaker")).getEntity();
Copy link
Member Author

Choose a reason for hiding this comment

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

Saves a bunch of bytes across the wire. We only really want the breaker stats.

}
}
return false;
}
Copy link
Member Author

Choose a reason for hiding this comment

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

Moved.

Also, we don't need this big comment. It was require when this test supported versions of elasticsearch without the capability api.

}

Map<?, ?> prevTooks = supportsTook() ? tooks() : null;
boolean checkTook = supportsTook() && rarely();
Copy link
Member Author

Choose a reason for hiding this comment

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

About 20% of the time we check took. It's actually pretty expensive to build. Not terribly so, but it shaved some load off of the test.

Copy link
Member Author

Choose a reason for hiding this comment

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

It's not our numbers that are expensive - it's the fact that we have to fetch the entire x-pack usage api.

capabilities.put(requiredCapabilities, cap);
}
return cap;
}
Copy link
Member Author

Choose a reason for hiding this comment

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

Moved this up to this class so others could share in the cache.

*/
private static final Map<List<String>, Boolean> capabilities = new ConcurrentHashMap<>();

public static boolean hasCapabilities(RestClient client, List<String> requiredCapabilities) throws IOException {
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like List<String> requiredCapabilities always have 1 item in it. Is it worth simplifying? May be I missed some usage?

Copy link
Member Author

Choose a reason for hiding this comment

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

csv-spec files make a list actually.

nik9000 and others added 2 commits July 28, 2025 10:04
…pack/esql/qa/rest/RestEsqlTestCase.java

Co-authored-by: Ievgen Degtiarenko <[email protected]>
@nik9000 nik9000 changed the title ESQL: Check speed up spec tests ESQL: Speed up spec tests Jul 28, 2025
@nik9000 nik9000 enabled auto-merge (squash) July 28, 2025 15:00
@nik9000 nik9000 merged commit d507b26 into elastic:main Jul 30, 2025
33 checks passed
afoucret pushed a commit to afoucret/elasticsearch that referenced this pull request Jul 31, 2025
Speeds up the spec tests by:
* Randomize `async`/`sync` instead of both
* Check the took time rarely
* Don't check if index exists every time
* Reduce transfer when checking breaker
* Cache capabilities checks

The first one is most of the speed up but the rest save another couple
of minutes. Time drops from 13m45s to 6m or so on my laptop.
smalyshev pushed a commit to smalyshev/elasticsearch that referenced this pull request Jul 31, 2025
Speeds up the spec tests by:
* Randomize `async`/`sync` instead of both
* Check the took time rarely
* Don't check if index exists every time
* Reduce transfer when checking breaker
* Cache capabilities checks

The first one is most of the speed up but the rest save another couple
of minutes. Time drops from 13m45s to 6m or so on my laptop.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Analytics/ES|QL AKA ESQL Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) >test Issues or PRs that are addressing/adding tests v9.2.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants