Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
8ea442d
Merge pull request #5 from envoyproxy/master
eric846 Jun 1, 2020
5ac755a
Merge pull request #6 from envoyproxy/master
eric846 Jun 28, 2020
b8c25a5
Merge pull request #7 from envoyproxy/master
eric846 Jul 7, 2020
1c19c68
initial commit
eric846 Jul 9, 2020
7050686
fix comments
eric846 Jul 9, 2020
0776563
fix format
eric846 Jul 9, 2020
16fd8f6
rename adaptive_rps to adaptive_load
eric846 Jul 10, 2020
c383010
add field_selector in example
eric846 Jul 10, 2020
6e1a483
fix example comment
eric846 Jul 10, 2020
4ef1140
fix format
eric846 Jul 10, 2020
4111bf4
add support for fault injection headers
eric846 Jul 10, 2020
871a959
replace linear and binary search with exponential search
eric846 Jul 10, 2020
1fd77c1
add InputVariableSetter mechanism
eric846 Jul 11, 2020
edc36b2
add input variable setter to build file
eric846 Jul 11, 2020
4d0364e
fix syntax errors
eric846 Jul 11, 2020
aed6d94
rename samples/adaptive_rps
eric846 Jul 11, 2020
d9ae87d
improve comments, change step controller initial value from int64 to …
eric846 Jul 12, 2020
a05a6f5
add proto validation rules, fix comments, make rps the default input_…
eric846 Jul 13, 2020
8cd4d21
fix comment wording
eric846 Jul 13, 2020
d814a96
simplify protos, add defaults, specify required or optional
eric846 Jul 14, 2020
5f5a885
add missing newline
eric846 Jul 14, 2020
7e20a78
Kick CI
eric846 Jul 14, 2020
9048267
simplify protos
eric846 Jul 15, 2020
306c0ec
fix format
eric846 Jul 15, 2020
d33f543
fix some optional field comments and rules
eric846 Jul 15, 2020
442cca9
Merge pull request #10 from envoyproxy/master
eric846 Jul 16, 2020
677b783
add Nighthawk status field in BenchmarkResult as nested nighthawk.cli…
eric846 Jul 19, 2020
cefb366
switch to standard Envoy plugin config proto, add prefix to internal …
eric846 Jul 22, 2020
f3684df
Merge remote-tracking branch 'upstream/master' into adaptive-rps-protos2
eric846 Jul 22, 2020
5463051
create headers
eric846 Jul 22, 2020
46e0e25
fix format
eric846 Jul 22, 2020
f634642
use docstring format
eric846 Jul 22, 2020
3c39faa
fix typos in comments
eric846 Jul 23, 2020
b9c8f2b
split build target, get rid of ostream, change InputValueSetter to us…
eric846 Jul 24, 2020
5fc4db4
remove nested namespace, remove redundant _include in target names
eric846 Jul 26, 2020
64e7852
merge from upstream
eric846 Jul 29, 2020
12807f1
Merge remote-tracking branch 'upstream/master' into adaptive-rps-headers
eric846 Jul 29, 2020
e8e960f
merge from upstream
eric846 Aug 27, 2020
d1f4c3d
remove status fields from result protos, change PerformAdaptiveLoadSe…
eric846 Aug 27, 2020
d835e72
fix incorrect references to nighthawk_traffic_template in comment
eric846 Aug 27, 2020
1b9df26
clarify comment
eric846 Aug 27, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 13 additions & 11 deletions api/adaptive_load/adaptive_load.proto
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,22 @@ message AdaptiveLoadSessionSpec {
// A proto describing Nighthawk Service traffic. See
// https://github.com/envoyproxy/nighthawk/blob/master/api/client/options.proto
//
// The adaptive load controller will return an error if the |duration| or
// |open_loop| fields are set within |nighthawk_traffic_options|. The
// controller will also be configured to overwrite at least one of the
// numerical fields during the search, such as requests_per_second, so any
// value of those fields specified here will be ignored.
// The adaptive load controller will return an error if the |duration| field is set within
// |nighthawk_traffic_template|.
//
// All other fields in |nighthawk_traffic_options| are passed through to the
// If |open_loop| is unset, it will be overridden to true by the adaptive load controller. This is
// to support the typical case where the controller needs full control over attempted requests per
// second, which could conflict with the backpressure mechanism of closed-loop mode. Note that in
// standalone Nighthawk clients, closed-loop mode is the default.
//
// The controller will override at least one field in this proto to vary the load, such as the
// requests_per_second field or headers. Any existing value for such a field in the template will
// be ignored.
//
// All other fields in |nighthawk_traffic_template| are passed through to the
// Nighthawk Service.
//
// Note that |concurrency| in |nighthawk_traffic_options| multiplies the total
// Note that |concurrency| in |nighthawk_traffic_template| multiplies the total
// RPS sent.
//
// Required.
Expand All @@ -65,10 +71,6 @@ message AdaptiveLoadSessionSpec {
// Complete description of an adaptive load session, including metric scores
// for every degree of load attempted during the adjusting stage.
message AdaptiveLoadSessionOutput {
// Overall status of the session with error detail. INVALID_ARGUMENT if the input spec contained
// errors, DEADLINE_EXCEEDED if convergence did not occur before the deadline, ABORTED if the step
// controller determined it can never converge.
google.rpc.Status session_status = 1;
// Results of each short benchmark performed during the adjusting stage.
repeated BenchmarkResult adjusting_stage_results = 2;
// Result of the single benchmark of the testing stage.
Expand Down
3 changes: 0 additions & 3 deletions api/adaptive_load/benchmark_result.proto
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ message BenchmarkResult {
// Raw Nighthawk Service output. Includes start/end times and full Nighthawk
// Service input spec.
nighthawk.client.Output nighthawk_service_output = 1;
// Execution status of this call to the Nighthawk Service. This will record errors connecting to
// the Nighthawk Service and internal errors returned from the Nighthawk Service.
google.rpc.Status status = 2;
// Status of all declared metrics during this benchmark session. Not present
// in the event of Nighthawk Service errors.
repeated MetricEvaluation metric_evaluations = 3;
Expand Down
1 change: 1 addition & 0 deletions include/nighthawk/adaptive_load/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ envoy_basic_cc_library(
"@envoy//include/envoy/common:base_includes",
"@envoy//include/envoy/common:time_interface",
"@envoy//include/envoy/config:typed_config_interface",
"@envoy//source/common/common:statusor_lib_with_external_headers",
],
)

Expand Down
9 changes: 5 additions & 4 deletions include/nighthawk/adaptive_load/adaptive_load_controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#include "envoy/common/time.h"

#include "external/envoy/source/common/common/statusor.h"

#include "api/adaptive_load/adaptive_load.pb.h"
#include "api/client/service.grpc.pb.h"

Expand All @@ -23,11 +25,10 @@ namespace Nighthawk {
* Envoy-based process, there may be an existing TimeSource or TimeSystem to use. If calling
* from a test, pass a fake TimeSource.
*
* @return AdaptiveLoadSessionOutput a proto logging the result of all traffic attempted and all
* corresponding metric values and scores. Any errors that occur will be recorded in the
* |session_status| field.
* @return StatusOr<AdaptiveLoadSessionOutput> A proto logging the result of all traffic attempted
* and all corresponding metric values and scores, or an overall error status if the session failed.
*/
nighthawk::adaptive_load::AdaptiveLoadSessionOutput PerformAdaptiveLoadSession(
absl::StatusOr<nighthawk::adaptive_load::AdaptiveLoadSessionOutput> PerformAdaptiveLoadSession(
nighthawk::client::NighthawkService::StubInterface* nighthawk_service_stub,
const nighthawk::adaptive_load::AdaptiveLoadSessionSpec& spec, Envoy::TimeSource& time_source);

Expand Down
4 changes: 0 additions & 4 deletions source/adaptive_load/step_controller_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,6 @@ bool ExponentialSearchStepController::IsDoomed(std::string& doom_reason) const {
}

void ExponentialSearchStepController::UpdateAndRecompute(const BenchmarkResult& benchmark_result) {
if (benchmark_result.status().code()) {
doom_reason_ = "Nighthawk Service returned an error.";
return;
}
const double score = TotalScore(benchmark_result);
if (is_range_finding_phase_) {
IterateRangeFindingPhase(score);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,6 @@ FakeStepController::GetCurrentCommandLineOptions() const {

void FakeStepController::UpdateAndRecompute(
const nighthawk::adaptive_load::BenchmarkResult& benchmark_result) {
if (benchmark_result.status().code() == ::grpc::OK) {
is_doomed_ = false;
doomed_reason_ = "";
} else {
is_doomed_ = true;
doomed_reason_ = benchmark_result.status().message();
}
// "Convergence" is defined as the latest benchmark reporting any score > 0.0.
is_converged_ = false;
for (const nighthawk::adaptive_load::MetricEvaluation& metric_evaluation :
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,38 +132,6 @@ TEST(FakeStepController, IsConvergedReturnsTrueAfterBenchmarkResultWithPositiveS
EXPECT_TRUE(step_controller.IsConverged());
}

TEST(FakeStepController, IsDoomedReturnsFalseAfterSuccessfulBenchmarkResult) {
FakeStepController step_controller(FakeStepControllerConfig{}, CommandLineOptions{});
BenchmarkResult benchmark_result;
benchmark_result.mutable_status()->set_code(::grpc::OK);
step_controller.UpdateAndRecompute(benchmark_result);
std::string doomed_reason;
EXPECT_FALSE(step_controller.IsDoomed(doomed_reason));
}

TEST(FakeStepController,
IsDoomedReturnsFalseAndLeavesDoomedReasonUntouchedAfterSuccessfulBenchmarkResult) {
FakeStepController step_controller(FakeStepControllerConfig{}, CommandLineOptions{});
BenchmarkResult benchmark_result;
benchmark_result.mutable_status()->set_code(::grpc::OK);
step_controller.UpdateAndRecompute(benchmark_result);
std::string variable_that_should_not_be_written = "original value";
EXPECT_FALSE(step_controller.IsDoomed(variable_that_should_not_be_written));
EXPECT_EQ(variable_that_should_not_be_written, "original value");
}

TEST(FakeStepController, IsDoomedReturnsTrueAndSetsDoomedReasonAfterFailedBenchmarkResult) {
const std::string kErrorMessage = "error from nighthawk";
FakeStepController step_controller(FakeStepControllerConfig{}, CommandLineOptions{});
BenchmarkResult benchmark_result;
benchmark_result.mutable_status()->set_code(::grpc::INTERNAL);
benchmark_result.mutable_status()->set_message(kErrorMessage);
step_controller.UpdateAndRecompute(benchmark_result);
std::string doomed_reason;
EXPECT_TRUE(step_controller.IsDoomed(doomed_reason));
EXPECT_EQ(doomed_reason, kErrorMessage);
}

TEST(MakeFakeStepControllerPluginConfig, ActivatesFakeStepControllerPlugin) {
absl::StatusOr<StepControllerPtr> plugin_or = LoadStepControllerPlugin(
MakeFakeStepControllerPluginConfig(0), nighthawk::client::CommandLineOptions{});
Expand Down
16 changes: 0 additions & 16 deletions test/adaptive_load/step_controller_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@ nighthawk::adaptive_load::BenchmarkResult MakeBenchmarkResultWithScore(double sc
return result;
}

nighthawk::adaptive_load::BenchmarkResult MakeBenchmarkResultWithNighthawkError() {
nighthawk::adaptive_load::BenchmarkResult result;
result.mutable_status()->set_code(1);
return result;
}

TEST(ExponentialSearchStepControllerConfigFactory, GeneratesEmptyConfigProto) {
auto& config_factory =
Envoy::Config::Utility::getAndCheckFactoryByName<StepControllerConfigFactory>(
Expand Down Expand Up @@ -175,16 +169,6 @@ TEST(ExponentialSearchStepController, ReportsDoomIfOutsideThresholdsOnInitialVal
EXPECT_THAT(doom_reason, HasSubstr("already exceed metric thresholds with the initial load"));
}

TEST(ExponentialSearchStepController, ReportsDoomAfterNighthawkServiceError) {
nighthawk::adaptive_load::ExponentialSearchStepControllerConfig config;
nighthawk::client::CommandLineOptions options_template;
ExponentialSearchStepController step_controller(config, options_template);
step_controller.UpdateAndRecompute(MakeBenchmarkResultWithNighthawkError());
std::string doom_reason;
EXPECT_TRUE(step_controller.IsDoomed(doom_reason));
EXPECT_EQ(doom_reason, "Nighthawk Service returned an error.");
}

TEST(ExponentialSearchStepController,
IncreasesRpsExponentiallyIfWithinThresholdUsingDefaultExponent) {
const double kInitialInput = 100.0;
Expand Down