Skip to content

Introduce Phases#219

Merged
mum4k merged 43 commits intoenvoyproxy:masterfrom
oschaaf:phases-pt1
Jan 16, 2020
Merged

Introduce Phases#219
mum4k merged 43 commits intoenvoyproxy:masterfrom
oschaaf:phases-pt1

Conversation

@oschaaf
Copy link
Copy Markdown
Member

@oschaaf oschaaf commented Nov 27, 2019

Introduces a concept of Phases into the system.

Phases represent named pieces of the overall benchmark execution.
For example, a warm-up phase could perform a ramp-up to a certain qps, and then a main phase could enable latency measurement and sustain the requested qps.

Currently this adds a warmup phase as an example, which is functionally on par with what we had before. Logical follow ups to this would:

  • be per-phase reporting
  • allowing phase configuration (generic or just adding a warmup/cooldown)
  • possibly dynamically injecting phases on the fly (in response to a gRPC call and/or CLI input and/or special test-server responses)

Groundwork for #31

Signed-off-by: Otto van der Schaaf oschaaf@we-amp.com


Prerequisites

Introduces a concept `Phases` into the system.
Phases represent pieces of the overall execution, scoping
statistics, configuration, and termination predicates.

For example, a warmup phase could be statically added based on
a clone of the main phase with a rate limiter which smoothly
ramps up to the target qps.

Currently a no-op, meant to initiate discussion and
have something concrete to start with.

Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
@oschaaf oschaaf changed the title [WIP] Phases concept [DRAFT] Phases concept Nov 27, 2019
Prerequisite to envoyproxy#217

Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
- Make the warmup phase equivalent to what is on master
- Back out changes in test expectations

Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
@oschaaf oschaaf changed the title [DRAFT] Phases concept Introduce Phases Dec 13, 2019
@oschaaf oschaaf marked this pull request as ready for review December 13, 2019 10:05
@oschaaf
Copy link
Copy Markdown
Member Author

oschaaf commented Dec 13, 2019

This is ready for review -- but it's probably easier to do so when we've merged #222 and merged master afterwards in here.

Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
@oschaaf oschaaf added waiting-for-review A PR waiting for a review. and removed waiting-for-changes A PR waiting for comments to be resolved and changes to be applied. labels Jan 10, 2020
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
@oschaaf oschaaf added this to the 0.3 milestone Jan 11, 2020
@mum4k
Copy link
Copy Markdown
Collaborator

mum4k commented Jan 13, 2020

@dubious90 agreed to take another look after the recent changes. Thank you Nate.

@mum4k mum4k removed their assignment Jan 13, 2020
Copy link
Copy Markdown
Contributor

@dubious90 dubious90 left a comment

Choose a reason for hiding this comment

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

Two main questions before I pass this back to mum4k

*benchmark_client_, *termination_predicate_,
*worker_number_scope_)) {}
phase_(std::make_unique<PhaseImpl>(
"main",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

is hardcoding this to main going to make it harder to allow arbitrary configuration of these later?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

No this shouldn’t matter for now, it will only show up in logs but otherwise is not visible externally.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just to clarify, does that mean this is temporary code that will be replaced later? Or that the use of main here is a secret phase that outside users won't need to know about? If it's the latter, I'm concerned about name collision, but if it's the first, then agree there's no concern here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It's temporary code. This will be replaced with a generic mechanism that translates phases into configuration. So the id chosen here can be an arbitrary value, perhaps I should have better called it foo or some such to avoid confusion.

* @param should_measure_latencies Indicates if latencies should be tracked for requests issued
* during execution of this phase.
* @param time_source Time source that will be used to query the clock.
* @param start_time Optional starting time of the phase. Can be used to schedule phases ahead.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't know if start_time is a good way to schedule phases to run. Isn't NH currently being orchestrated so that processes can not run on top of themselves? And wouldn't time delays cause unexpected behavior with multiple consumers using the service?

Could we instead treat phases more like a list (maybe a linked list)? Then when one phase ends, we could start the next phase if one exists? Rather than this process holding mechanism?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is a re-implementation of something used today as a means to offset load test starts, to ensure request timings are evenly spaced from a global perspective. See https://github.com/envoyproxy/nighthawk/pull/219/files/c927a6ed9c006a0778813cf495c920408d1785bd#discussion_r363545616 for more context

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'll leave this up to you and @mum4k for if that makes sense architecturally. My concern is that we're defining an ordering mechanism directly into phases that doesn't seem to fit for phases, and we're repurposing it in ClientWorkerImpl for replacing a currently existing functionality that does not seem to have much to do with phases.

For whatever it's worth, that discussion link doesn't work, so I don't know what context you're referring to.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The right link to the earlier discussion ought to have been #219 (comment). Somehow the previous one went bad, sorry.
But point taken, somehow this doesn't fit well with me either, but so far I wasn't able to come up with something better. But reading back the linked discussion:

Maybe this should move into a different concept. I also had a concern with that this concept won't hold well with the new rate limiters we recently landed, and with non-probabilistic timing it doesn't make sense either. So maybe we should contain this functionality in a DelayStartingRateLimiter instead of here in Phase. How would you feel about that?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I support your last suggestion @oschaaf, it makes the concept of phase more focused.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Great; I added #281 as a prerequisite to this PR

Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
@dubious90
Copy link
Copy Markdown
Contributor

I've left a couple questions, but as they likely do not require changes, assigning back to @mum4k for approval

Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
@mum4k mum4k added waiting-for-changes A PR waiting for comments to be resolved and changes to be applied. and removed waiting-for-review A PR waiting for a review. labels Jan 15, 2020
oschaaf added a commit to oschaaf/nighthawk that referenced this pull request Jan 15, 2020
As per discussion [1], this is intended to be used as a replacement
for the way we offset worker request release timings today.

[1] envoyproxy#219 (comment)

Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
@oschaaf oschaaf added the blocked A PR that is blocked by prerequisites. label Jan 15, 2020
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
mum4k pushed a commit that referenced this pull request Jan 15, 2020
As per discussion [1], this is intended to be used as a replacement
for the way we offset worker request release timings today.

[1] #219 (comment)

Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
@oschaaf oschaaf added waiting-for-review A PR waiting for a review. and removed blocked A PR that is blocked by prerequisites. waiting-for-changes A PR waiting for comments to be resolved and changes to be applied. labels Jan 15, 2020
@oschaaf
Copy link
Copy Markdown
Member Author

oschaaf commented Jan 15, 2020

This now leverages ScheduledStartingRateLimiter, and PhaseImpl has been cleaned up.

@mum4k mum4k merged commit 0dd90fd into envoyproxy:master Jan 16, 2020
oschaaf added a commit to oschaaf/nighthawk that referenced this pull request Jan 17, 2020
This reverts commit 0dd90fd.

Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
oschaaf added a commit that referenced this pull request Jan 17, 2020
This reverts commit 0dd90fd.

Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
oschaaf added a commit to oschaaf/nighthawk that referenced this pull request Jan 17, 2020
This reverts commit 870d7c8.

Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 waiting-for-review A PR waiting for a review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants