Conversation
start time. 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>
|
@qqustc Please review and assign back to me once ready. |
| const std::map<std::string, uint64_t>& counters, | ||
| const std::chrono::nanoseconds execution_duration) PURE; | ||
| const std::chrono::nanoseconds execution_duration, | ||
| const absl::optional<Envoy::SystemTime>& first_acquisition_time) PURE; |
There was a problem hiding this comment.
Add comment for first_acquisition_time?
LGTM, assigned back to @dubious90 for review. |
| TerminationPredicatePtr&& termination_predicate, | ||
| Envoy::Stats::Scope& scope, | ||
| const Envoy::SystemTime scheduled_starting_time) const PURE; | ||
| const Envoy::MonotonicTime scheduled_starting_time) const PURE; |
There was a problem hiding this comment.
Not actionable, just making sure I'm understanding - this is where we're moving back to MonotonicTime to prevent #569 ?
| const std::map<std::string, uint64_t>& counters, | ||
| const std::chrono::nanoseconds execution_duration) PURE; | ||
| const std::chrono::nanoseconds execution_duration, | ||
| const absl::optional<Envoy::SystemTime>& first_acquisition_time) PURE; |
There was a problem hiding this comment.
will likely be addressed when the comment is added, but I'm not sure i understand what acquisition means in this context.
source/client/process_impl.cc
Outdated
| // track-for-future issue. | ||
| const auto first_worker_start = time_system_.systemTime() + kMinimalWorkerDelay; | ||
| const Envoy::MonotonicTime monotonic_now = time_system_.monotonicTime(); | ||
| const std::chrono::nanoseconds offset = |
There was a problem hiding this comment.
- I might be misunderstanding but this ternary seems off to me. kMinimalWorkerDelay has the worker offsets baked into it, correct? So, if we are using a scheduled start time, and we aren't using minimal worker delay at all, then we aren't including any worker offsets from each other.
So now, batching behavior of nighthawk acts differently depending on whether or not we are using a schedule which doesn't seem right.
There was a problem hiding this comment.
This computes the start of the first worker, we will still be injecting an offset between each worker below. I refactored this for clarity, hopefully it's easier to read now.
source/client/process_impl.cc
Outdated
| // global status quo, which we do not have right now. This has been noted in the | ||
| // track-for-future issue. | ||
| const auto first_worker_start = time_system_.systemTime() + kMinimalWorkerDelay; | ||
| const Envoy::MonotonicTime monotonic_now = time_system_.monotonicTime(); |
There was a problem hiding this comment.
Three comments here:
- This has gotten complex enough (especially with the long comments above to explain what's going on), that I think it might warrant its own privately scoped function. CalculateWorkerStartTime_ or something?
source/client/process_impl.cc
Outdated
| const auto first_worker_start = time_system_.systemTime() + kMinimalWorkerDelay; | ||
| const Envoy::MonotonicTime monotonic_now = time_system_.monotonicTime(); | ||
| const std::chrono::nanoseconds offset = | ||
| schedule.has_value() ? schedule.value() - time_system_.systemTime() : kMinimalWorkerDelay; |
There was a problem hiding this comment.
- We are heavily explaining the workerdelay behavior here in the comment above. Can we add a one-line comment for how the schedule behavior fits in? For instance, if I am wrong about point 2 above, we should say why the scheduled workers don't need an offset delay.
| /** | ||
| * @return absl::optional<Envoy::SystemTime> Time of the first acquisition, if any. | ||
| */ | ||
| virtual absl::optional<Envoy::SystemTime> firstAcquisitionTime() const PURE; |
There was a problem hiding this comment.
I might have just missed it in this pull request (if so, please point me to the right file), but while I'm seeing code that writes this field or passes it around, I'm not finding where it's actually used functionally. What is its intended purpose?
There was a problem hiding this comment.
This gets consumed over at https://github.com/envoyproxy/nighthawk/pull/573/files#diff-e528c3973715873e2ec7fcac6a842e5d9a59d6523a77bf1219d295dd4c7285cdR539 and ends up in the output as execution_start.
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>
for clarity. Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
|
@dubious90 Thanks for the feedback, I think I addressed it. Extracted the worker start time & offset calculations into their own methods for clarity. Ready for another round! |
dubious90
left a comment
There was a problem hiding this comment.
Looks good. Thanks for the readability changes! It's really easy to follow what's happening now.
Adds a new schedule option to the proto api., which allows specifying a date/time
at which execution should start.
Should also fix #569 by reducing reliance on
Envoy::SystemTimeto a minimum:Based on the value schedule option, a monotonic time will be computed
and propagated. This makes us use
Envoy::MonotonicTimeagain in placeswhere sub ms resolution is a must have. (The fix will need confirmation, as I
couldn't get
--config=libc++to work for other reasons.)