Skip to content

BenchmarkRunner fixes and make it extensible#14670

Merged
caithagoras merged 7 commits intoprestodb:masterfrom
caithagoras:s2
Jul 22, 2020
Merged

BenchmarkRunner fixes and make it extensible#14670
caithagoras merged 7 commits intoprestodb:masterfrom
caithagoras:s2

Conversation

@caithagoras
Copy link
Contributor

@caithagoras caithagoras commented Jun 18, 2020

== NO RELEASE NOTES ==

@caithagoras caithagoras requested a review from yingsu00 June 18, 2020 01:47
@yingsu00
Copy link
Contributor

Make BenchmarkSupplierSupplier extensible Did you mean BenchmarkSuiteSupplier instead?

@caithagoras caithagoras force-pushed the s2 branch 2 times, most recently from c2b99c1 to 95eb1a0 Compare June 18, 2020 03:13
@caithagoras
Copy link
Contributor Author

caithagoras commented Jun 18, 2020

@yingsu00 Yes. Updated all commit messages.

Copy link
Contributor

@yingsu00 yingsu00 left a comment

Choose a reason for hiding this comment

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

Make BenchmarkSuiteSupplier extensible LGTM with a tiny nit
Make benchmark runner extensible LGTM
Run out of time today. Will continue read tomorrow

@caithagoras
Copy link
Contributor Author

@yingsu00 Thanks. comments addressed.

@caithagoras caithagoras force-pushed the s2 branch 4 times, most recently from 10c70f4 to 7103f33 Compare June 19, 2020 06:09
@caithagoras
Copy link
Contributor Author

caithagoras commented Jun 19, 2020

Added a few more refactoring commits to prepare for supporting StreamPhaseExecutor. Adding tests for commit 6.

@caithagoras caithagoras force-pushed the s2 branch 4 times, most recently from 6830665 to 96294e7 Compare June 19, 2020 22:44
@caithagoras
Copy link
Contributor Author

@yingsu00 All tests added.

Copy link
Contributor

@yingsu00 yingsu00 left a comment

Choose a reason for hiding this comment

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

Make max concurrency optional in ConcurrentExecutionPhase LGTM. Just add comment to define what STREAM/CONCURRENT means.

Copy link
Contributor

Choose a reason for hiding this comment

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

Does STREAM mean single stream and CONCURRENT means multiple of streams? Or CONCURRENT means no streams? Could you add some comment?

Copy link
Contributor

@yingsu00 yingsu00 left a comment

Choose a reason for hiding this comment

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

Fix PhaseSpecification LGTM

Copy link
Contributor

Choose a reason for hiding this comment

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

Why is the queries mutable? Everything else is final, why does the queries need to change given a fixed suite and querySet?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Answered below.

Copy link
Contributor

Choose a reason for hiding this comment

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

Same question as above: why do we need to use setQueries instead of make it part of the constructor?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You can find that all fields of BenchmarkSuite are immutable. queries is mutable only in this JdbiBuilder inner-class.

Why do we need to use setQueries instead of make it part of the constructor?
This is because we need to run 2 MySQL queries to fetch all information about a suite.

  1. dao.getBenchmarkSuite gets some the suite configuration by reading benchmark_suites.
  2. dao.getBenchmarkQueries gets the list of queries by reading benchmark_queries.

The result of 1st query needs to be stored in some intermediate object. Before the refactoring, the result is mapped to BenchmarkSuiteInfo class, and a BenchmarkSuite contains both BenchmarkSuiteInfo and the query lists. With the refactoring, I removed BenchmarkSuiteInfo, and replace it with the builder class instead. The result of the 1st query is mapped to BenchmarkSuite.JdbiBuilder using the constructor, while the result of the 2nd query is added to the build using the setter. And finally JdbiBuilder.build() returns a BenchmarkSuite object.

Copy link
Contributor

Choose a reason for hiding this comment

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

Why are all tests with empty session properties? Can we add some test with non-empty session properties?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Test added.

@yingsu00
Copy link
Contributor

@caithagoras any thoughts on the comments?

@yingsu00 yingsu00 requested a review from mbasmanova June 30, 2020 19:01
- Move the logic of DbBenchmarkSuiteSupplier into an abastract
  base class AbstractJdbiBenchmarkSuiteSupplier.
- Move MySqlBenchmarkSuiteConfig to the correct package.
Move logic from PrestoBenchmarkCommand to an abstract base class.
Fix JSON serialization and deserialization for subclasses of
PhaseSpecification. It is unnecessay to make ExecutionStrategy
a field or JSON field. Instead, ExecutionStrategy is static for
any subclasses of PhaseExecution.

Also,
- Fix equals() and hashCode()
- Move ExecutionStrategy to top-level
Remove BenchmarkSuiteInfo and move all its fields into BenchmarkSuite.
Use a builder object of BenchmarkSuite to hold the intermediate
suite information fetched from MySQL.
- Re-define interface PhaseExecutor so that a PhaseExecutor is a
  stateless object and is reused across phases.
- Move BenchmarQueryRunner into AbstractPhaseExecutor.
- Shutdown executor in a single place.
- Post events in single places.
- Move all classes in executor package to framework package.
Allow max concurrency for concurrent phases to be specified
through config.

- Use the max concurrency from config if specified.
- Else, use the max concurrency specified in phase specification.
- Else, use the default max concurrency 70.
@caithagoras
Copy link
Contributor Author

@yingsu00 comments addressed

@caithagoras
Copy link
Contributor Author

@mbasmanova Could you help approve this PR?

@yingsu00 yingsu00 self-requested a review June 30, 2020 21:05
@mbasmanova
Copy link
Contributor

@caithagoras I don't have context on this change and I won't have bandwidth to review it.

@yingsu00 yingsu00 requested a review from rongrong June 30, 2020 21:42
@yingsu00
Copy link
Contributor

@rongrong will you be able to review this PR? Thank you!

@yingsu00
Copy link
Contributor

@caithagoras I don't have context on this change and I won't have bandwidth to review it.

Hi Masha, this PR is part of Issue #14111

@caithagoras
Copy link
Contributor Author

cc @rongrong for final approval

{
private final BenchmarkSuiteSupplier benchmarkSuiteSupplier;
private final PhaseExecutorFactory phaseExecutorFactory;
private final ConcurrentPhaseExecutor concurrentPhaseExecutor;
Copy link
Contributor

Choose a reason for hiding this comment

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

So basically BenchmarkRunner will have as many executors are there are execution strategies?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, and there will only be 2 in the foreseeable future. CONCURRENT and STREAM

@caithagoras caithagoras merged commit 2cb629e into prestodb:master Jul 22, 2020
@caithagoras caithagoras deleted the s2 branch July 22, 2020 22:31
@caithagoras caithagoras mentioned this pull request Jul 28, 2020
13 tasks
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.

5 participants