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

Added new bench target 'bench-fast' #297

Closed
wants to merge 11 commits into from
Closed

Conversation

Player256
Copy link

Resolves #292
Added a bool flag -fast.

@@ -101,6 +102,10 @@ func BenchmarkSingleQuery(b *testing.B) {
}

func BenchmarkRangeQuery(b *testing.B) {

Choose a reason for hiding this comment

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

can we just use tesitng.Short() for this?

Signed-off-by: Player256 <[email protected]>
Copy link

@mhoffm-aiven mhoffm-aiven left a comment

Choose a reason for hiding this comment

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

Can we also do the benchstat?

@Player256
Copy link
Author

yes

@mhoffm-aiven
Copy link

Does it actually work though; the big datasets are still constructed before the benchmark, right? Ill give it a go during EU afternoon.

@Player256
Copy link
Author

Does it actually work though; the big datasets are still constructed before the benchmark, right? Ill give it a go during EU afternoon.

hey should I put if statements using testing.short() around the larger dataset.

@mhoffm-aiven
Copy link

Does it actually work though; the big datasets are still constructed before the benchmark, right? Ill give it a go during EU afternoon.

hey should I put if statements using testing.short() around the larger dataset.

that will hide the identifier probably; but i think it can be structured nicer somewhat; We could factor out the slow benchmarks and skip those completely if we have a "Short" flag.

@fpetkovski
Copy link
Collaborator

Agree, we should avoid creating the large datasets altogether if -short is provided. We could declare them but not initialize them to make compilation pass.

@mhoffm-aiven
Copy link

mhoffm-aiven commented Aug 2, 2023

We could add b.Run("fast", ...) where we do construct and use 6h dataset and b.Run("slow", ...) where we construct and use the large datasets and that we skip when the "short" flag is set. wdyt?

@Player256
Copy link
Author

We could add b.Run("fast", ...) where we do construct and use 6h dataset and b.Run("slow", ...) where we construct and use the large datasets and that we skip when the "short" flag is set. wdyt?

I was thinking like this :
`var largeSixHourDataset promql.Test
if !testing.Short() {
largeSixHourDataset = setupStorage(b, 10000, 10, 6
samplesPerHour)
defer largeSixHourDataset.Close()
}

var sevenDaysAndTwoHoursDataset *promql.Test
if !testing.Short() {
	sevenDaysAndTwoHoursDataset = setupStorage(b, 1000, 3, (7*24+2)*samplesPerHour)
	defer sevenDaysAndTwoHoursDataset.Close()
}`

@Player256
Copy link
Author

@mhoffm-aiven @fpetkovski any thoughts on this?

@MichaHoffmann
Copy link
Contributor

I would prefer if we group them under "b.Run("fast", ...)" and "b.Run("slow", ...)" and only construct the necessary datasets for the given run

nishchay-veer and others added 6 commits August 17, 2023 00:59
* CPU time consumed by each operator

Signed-off-by: nishchay-veer <[email protected]>

* Time consumed by operator when calling Next

the TimingOperator struct wraps another VectorOperator and includes a startTime field to track the start time of each Next method call. Inside the Next method implementation of TimingOperator, it captures the current time using time.Now() and stores it in the startTime field. Then, it calls the Next method of the wrapped operator.

Signed-off-by: nishchay-veer <[email protected]>

* Generalise timing operator for scalar and aggregate

Signed-off-by: nishchay-veer <[email protected]>

* Added recordTime and duration field in numberLiteralSelector

added a boolean flag recordTime to enable or disable recording of time taken.If it is enabled, then I have added the code to record the time taken to the duration field. Also modified the constantMetric to include a new label called .

Signed-off-by: nishchay-veer <[email protected]>

* embedding instead of wrapping operator inside of operator

The changes are done for capturing observability information for operators in a clean and modular way. By using embedding instead of wrapping, it allows for more granular data capture without creating cross-references between operators.

Signed-off-by: nishchay-veer <[email protected]>

* Added Analyze method in ExplainableQuery interface

The Analyze method returns an AnalyzeOutputNode, which represents the analysis of the query execution. This analysis can include performance metrics, such as CPU time, memory usage, or other relevant statistics. The Analyze method allows for capturing observability information during query execution to assess performance

Signed-off-by: nishchay-veer <[email protected]>

* Added analyze function for local testing

Signed-off-by: nishchay-veer <[email protected]>

* Include ObservableVectorOperator in building the operator tree

Signed-off-by: nishchay-veer <[email protected]>

* Minor changes for type assertion

Signed-off-by: nishchay-veer <[email protected]>

* Type casting into model.ObservableVectorOperator

Signed-off-by: nishchay-veer <[email protected]>

* Initialised TimingInformation to avoid nil case

Signed-off-by: nishchay-veer <[email protected]>

* Next call when Analyze query

Signed-off-by: nishchay-veer <[email protected]>

* Fixed some checks failing

Signed-off-by: nishchay-veer <[email protected]>

* Embed struct

Signed-off-by: nishchay-veer <[email protected]>

* Test code for Query Analyze

Signed-off-by: nishchay-veer <[email protected]>

* Embed model.OperatorTelemetry

Signed-off-by: nishchay-veer <[email protected]>

* Assertion function for non-zero CPU Time

Signed-off-by: nishchay-veer <[email protected]>

* Adding model.OperatorTelemetry to each operator

Signed-off-by: nishchay-veer <[email protected]>

* Capturing CPUTime of each operator

Signed-off-by: nishchay-veer <[email protected]>

* engine: actually execute the query

Signed-off-by: Giedrius Statkevičius <[email protected]>

* Find time consumed by each operator

Signed-off-by: nishchay-veer <[email protected]>

* Removed unnecessary type casting

Signed-off-by: nishchay-veer <[email protected]>

* Added analyze function for local testing

Signed-off-by: nishchay-veer <[email protected]>

* Initialised TimingInformation to avoid nil case

Signed-off-by: nishchay-veer <[email protected]>

* Next call when Analyze query

Signed-off-by: nishchay-veer <[email protected]>

* Adding model.OperatorTelemetry to each operator

Signed-off-by: nishchay-veer <[email protected]>

* Capturing CPUTime of each operator

Signed-off-by: nishchay-veer <[email protected]>

* Find time consumed by each operator

Signed-off-by: nishchay-veer <[email protected]>

* Removed unnecessary type casting

Signed-off-by: nishchay-veer <[email protected]>

* Fixed few minor nits

Signed-off-by: nishchay-veer <[email protected]>

* Added model.OperatorTelemetry to noArgFunOperator

Signed-off-by: nishchay-veer <[email protected]>

* Removing type checks for model.TimingInformation

Signed-off-by: nishchay-veer <[email protected]>

* Removed type checks

Signed-off-by: nishchay-veer <[email protected]>

* Removed type checks in TestQueryAnalyze

Signed-off-by: nishchay-veer <[email protected]>

* Fixed few minors issues

Signed-off-by: nishchay-veer <[email protected]>

* modified TestQueryAnalyze to check for child operators

Signed-off-by: nishchay-veer <[email protected]>

* linters check passed

Signed-off-by: nishchay-veer <[email protected]>

* Added operatorTelemetry to each operator

Signed-off-by: nishchay-veer <[email protected]>

* Changed TimingInformation to TrackedTelemetry for recording other telemetry information

Signed-off-by: nishchay-veer <[email protected]>

* Remove  nil case in slice of operators

Signed-off-by: nishchay-veer <[email protected]>

* removing unnecessary typecasts

Signed-off-by: nishchay-veer <[email protected]>

* Set name of operators

Signed-off-by: nishchay-veer <[email protected]>

* Removed Explain overheads from AnalyzeOutputNode

Signed-off-by: nishchay-veer <[email protected]>

* added setName() method to Analyze

Signed-off-by: nishchay-veer <[email protected]>

* fixed engine_test

Signed-off-by: nishchay-veer <[email protected]>

* Removed name from NoopTelemetry

Signed-off-by: nishchay-veer <[email protected]>

* Rename CPU Time -> Execution time

Signed-off-by: Giedrius Statkevičius <[email protected]>

* engine: clean up last CPUTime reference

Signed-off-by: Giedrius Statkevičius <[email protected]>

* execution: rename more fields

Signed-off-by: Giedrius Statkevičius <[email protected]>

---------

Signed-off-by: nishchay-veer <[email protected]>
Signed-off-by: Giedrius Statkevičius <[email protected]>
Signed-off-by: Nishchay Veer <[email protected]>
Co-authored-by: Giedrius Statkevičius <[email protected]>
* Propagate warnings through context

The engine does not return warnings from storage which causes problems
with partial response detection in Thanos.

I initially thought we had to change the interface of each operator,
but @MichaHoffmann had a neat idea to propagate warnings through the context
since they have no impact on flow control.

Signed-off-by: Filip Petkovski <[email protected]>

* Fix lint

Signed-off-by: Filip Petkovski <[email protected]>

* Replace fmt.Errorf with errors.New

Signed-off-by: Filip Petkovski <[email protected]>

* Use custom type as key

Signed-off-by: Filip Petkovski <[email protected]>

---------

Signed-off-by: Filip Petkovski <[email protected]>
This is a follow up commit to thanos-io#298 which
enables propagating warnings from remote engines into the distributed
query context.

Signed-off-by: Filip Petkovski <[email protected]>
Signed-off-by: Player256 <[email protected]>
Signed-off-by: Player256 <[email protected]>
@Player256
Copy link
Author

Why is the dco check failing even though I had signed off in the commits?

@Player256 Player256 closed this Nov 16, 2023
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.

Add bench-fast make target which excludes long-running benchmarks
5 participants