Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
13 changes: 13 additions & 0 deletions ci/do_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,14 @@ function do_check_format() {
./tools/format_python_tools.sh check
}

function do_build_nighthawk_image() {
echo "Building docker images"
do_opt_build

echo "do_docker: Running ci/docker/docker_build.sh."
./ci/docker/docker_build.sh
}

function do_docker() {
echo "docker..."
cd "${SRCDIR}"
Expand Down Expand Up @@ -368,6 +376,11 @@ case "$1" in
do_opt_build
exit 0
;;
build_nighthawk_image)
setup_clang_toolchain
do_build_nighthawk_image
exit 0
;;
*)
echo "must be one of [opt_build,build,test,clang_tidy,coverage,coverage_integration,asan,tsan,benchmark_with_own_binaries,docker,check_format,fix_format,test_gcc]"
exit 1
Expand Down
11 changes: 6 additions & 5 deletions ci/docker/Dockerfile-nighthawk
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
FROM ubuntu:24.04@sha256:1e622c5f073b4f6bfad6632f2616c7f59ef256e96fe78bf6a595d1dc4376ac02

RUN apt-get update && apt-get install libatomic1
RUN apt -y update && apt -y install libatomic1 curl

ADD nighthawk_client /usr/local/bin/nighthawk_client
ADD nighthawk_test_server /usr/local/bin/nighthawk_test_server
ADD nighthawk_output_transform /usr/local/bin/nighthawk_output_transform
ADD nighthawk_service /usr/local/bin/nighthawk_service
ADD nighthawk_adaptive_load_client /usr/local/bin/nighthawk_adaptive_load_client
ADD default-config.yaml /etc/envoy/envoy.yaml

ADD default-config.yaml /etc/nighthawk/nighthawk.yaml

# Ports for nighthawk_test_server, see default-config.yaml
EXPOSE 10001
EXPOSE 10080
EXPOSE 10001 10080
# The default port for nighthawk_service
EXPOSE 8443

CMD ["-c", "/etc/envoy/envoy.yaml"]
ENTRYPOINT ["/usr/local/bin/nighthawk_test_server"]
CMD ["-c", "/etc/nighthawk/nighthawk.yaml"]
65 changes: 37 additions & 28 deletions ci/docker/default-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,40 @@ admin:
socket_address: { address: 0.0.0.0, port_value: 10001 }
static_resources:
listeners:
- address:
socket_address:
address: 0.0.0.0
port_value: 10080
filter_chains:
- filters:
- name: envoy.http_connection_manager
config:
generate_request_id: false
codec_type: auto
stat_prefix: ingress_http
route_config:
name: local_route
virtual_hosts:
- name: service
domains:
- "*"
http_filters:
- name: time-tracking
- name: dynamic-delay
- name: test-server
config:
response_body_size: 10
v3_response_headers:
- { header: { key: "x-nh", value: "1"}}
- name: envoy.router
config:
dynamic_stats: false
- address:
socket_address:
address: 0.0.0.0
port_value: 10080
filter_chains:
- filters:
- name: envoy.filters.network.http_connection_manager
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
generate_request_id: false
codec_type: AUTO
stat_prefix: ingress_http
route_config:
name: local_route
virtual_hosts:
- name: service
domains:
- "*"
http_filters:
- name: time-tracking
typed_config:
"@type": type.googleapis.com/nighthawk.server.TimeTrackingConfiguration
emit_previous_request_delta_in_response_header: x-origin-request-receipt-delta
- name: dynamic-delay
typed_config:
"@type": type.googleapis.com/nighthawk.server.DynamicDelayConfiguration
static_delay: 0s
- name: test-server # before envoy.router because order matters!
typed_config:
"@type": type.googleapis.com/nighthawk.server.ResponseOptions
response_body_size: 10
v3_response_headers:
- { header: { key: "x-nh", value: "1" } }
- name: envoy.filters.http.router
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
dynamic_stats: false
6 changes: 3 additions & 3 deletions ci/docker/docker_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ set -e
# publishing sensitive information into public CI logs if someone makes a change in a
# consuming script that is off guard.

DOCKER_NAME="nighthawk"
DOCKER_IMAGE_PREFIX="envoyproxy/${DOCKER_NAME}"
DOCKER_IMAGE_PREFIX="${DOCKER_IMAGE_PREFIX:-envoyproxy/nighthawk}"

BINARIES=(nighthawk_test_server nighthawk_client nighthawk_service nighthawk_output_transform nighthawk_adaptive_load_client)
BAZEL_BIN="$(bazel info -c opt bazel-bin)"
WORKSPACE="$(bazel info workspace)"
Expand All @@ -33,6 +33,6 @@ done

cd "${TMP_DIR}"
echo "running docker build ... "
docker build -f "${TMP_DIR}/Dockerfile-${DOCKER_NAME}" -t "${DOCKER_IMAGE_PREFIX}-dev:latest" .
docker build -f "${TMP_DIR}/Dockerfile-nighthawk" -t "${DOCKER_IMAGE_PREFIX}-dev:latest" .
rm -rf "${TMP_DIR}"
echo "docker build finished"
2 changes: 1 addition & 1 deletion source/client/benchmark_client_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ void BenchmarkClientHttpImpl::terminate() {
ENVOY_LOG(info, "Wait for the connection pool drain timed out, proceeding to hard shutdown.");
dispatcher_.exit();
});
drain_timer_->enableTimer(30s);
drain_timer_->enableTimer(timeout_);
dispatcher_.run(Envoy::Event::Dispatcher::RunType::RunUntilExit);
}
}
Expand Down
3 changes: 2 additions & 1 deletion source/client/benchmark_client_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ class BenchmarkClientHttpImpl : public BenchmarkClient,
void setMaxRequestsPerConnection(uint32_t max_requests_per_connection) {
max_requests_per_connection_ = max_requests_per_connection;
}
void setTimeout(std::chrono::seconds timeout) { timeout_ = timeout; }

// BenchmarkClient
void terminate() override;
Expand Down Expand Up @@ -161,7 +162,7 @@ class BenchmarkClientHttpImpl : public BenchmarkClient,
Envoy::Stats::ScopeSharedPtr scope_;
BenchmarkClientStatistic statistic_;
const Envoy::Http::Protocol protocol_;
std::chrono::seconds timeout_{5s};
std::chrono::seconds timeout_{30s};
uint32_t connection_limit_{1};
uint32_t max_pending_requests_{1};
uint32_t max_active_requests_{UINT32_MAX};
Expand Down
2 changes: 2 additions & 0 deletions source/client/factories_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ BenchmarkClientPtr BenchmarkClientFactoryImpl::create(
benchmark_client->setMaxPendingRequests(options_.maxPendingRequests());
benchmark_client->setMaxActiveRequests(options_.maxActiveRequests());
benchmark_client->setMaxRequestsPerConnection(options_.maxRequestsPerConnection());
benchmark_client->setTimeout(options_.timeout());

return benchmark_client;
}

Expand Down
1 change: 1 addition & 0 deletions test/factories_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ TEST_F(FactoriesTest, CreateBenchmarkClient) {
EXPECT_CALL(options_, maxRequestsPerConnection());
EXPECT_CALL(options_, openLoop());
EXPECT_CALL(options_, responseHeaderWithLatencyInput());
EXPECT_CALL(options_, timeout());
auto cmd = std::make_unique<nighthawk::client::CommandLineOptions>();
EXPECT_CALL(options_, toCommandLineOptions()).WillOnce(Return(ByMove(std::move(cmd))));
StaticRequestSourceImpl request_generator(
Expand Down