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
30 changes: 23 additions & 7 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ build --enable_platform_specific_config

# Enable position independent code, this option is not supported on Windows and default on on macOS.
build:linux --copt=-fPIC
build:linux --cxxopt=-std=c++17

# We already have absl in the build, define absl=1 to tell googletest to use absl for backtrace.
build --define absl=1
Expand Down Expand Up @@ -71,6 +72,7 @@ build:clang-asan --config=asan
build:clang-asan --linkopt -fuse-ld=lld

# macOS ASAN/UBSAN
build:macos --cxxopt=-std=c++17
build:macos-asan --config=asan
# Workaround, see https://github.com/bazelbuild/bazel/issues/6932
build:macos-asan --copt -Wno-macro-redefined
Expand All @@ -87,6 +89,8 @@ build:clang-tsan --define ENVOY_CONFIG_TSAN=1
build:clang-tsan --copt -fsanitize=thread
build:clang-tsan --linkopt -fsanitize=thread
build:clang-tsan --linkopt -fuse-ld=lld
build:clang-tsan --build_tag_filters=-no_san,-no_tsan
build:clang-tsan --test_tag_filters=-no_san,-no_tsan
# Needed due to https://github.com/libevent/libevent/issues/777
build:clang-tsan --copt -DEVENT__DISABLE_DEBUG_MODE

Expand Down Expand Up @@ -134,23 +138,24 @@ build:coverage --strategy=CoverageReport=sandboxed,local
build:coverage --experimental_use_llvm_covmap
build:coverage --collect_code_coverage
build:coverage --test_tag_filters=-nocoverage
build:coverage --instrumentation_filter="//source(?!/common/chromium_url|/extensions/quic_listeners/quiche/platform)[/:],//include[/:]"
coverage:test-coverage --test_arg="--log-path /dev/null"
build:coverage --instrumentation_filter="//source(?!/extensions/quic_listeners/quiche/platform)[/:],//include[/:]"
coverage:test-coverage --test_arg="-l trace"
coverage:fuzz-coverage --config=asan-fuzzer
coverage:fuzz-coverage --config=plain-fuzzer
coverage:fuzz-coverage --run_under=@envoy//bazel/coverage:fuzz_coverage_wrapper.sh

# Remote execution: https://docs.bazel.build/versions/master/remote-execution.html
build:rbe-toolchain --host_platform=@envoy_build_tools//toolchains:rbe_ubuntu_clang_platform
build:rbe-toolchain --platforms=@envoy_build_tools//toolchains:rbe_ubuntu_clang_platform
build:rbe-toolchain --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1

build:rbe-toolchain-clang --config=rbe-toolchain
build:rbe-toolchain-clang --platforms=@rbe_ubuntu_clang//config:platform
build:rbe-toolchain-clang --host_platform=@rbe_ubuntu_clang//config:platform
build:rbe-toolchain-clang --crosstool_top=@rbe_ubuntu_clang//cc:toolchain
build:rbe-toolchain-clang --extra_toolchains=@rbe_ubuntu_clang//config:cc-toolchain
build:rbe-toolchain-clang --action_env=CC=clang --action_env=CXX=clang++ --action_env=PATH=/usr/sbin:/usr/bin:/sbin:/bin:/opt/llvm/bin

build:rbe-toolchain-clang-libc++ --config=rbe-toolchain
build:rbe-toolchain-clang-libc++ --platforms=@rbe_ubuntu_clang_libcxx//config:platform
build:rbe-toolchain-clang-libc++ --host_platform=@rbe_ubuntu_clang_libcxx//config:platform
build:rbe-toolchain-clang-libc++ --crosstool_top=@rbe_ubuntu_clang_libcxx//cc:toolchain
build:rbe-toolchain-clang-libc++ --extra_toolchains=@rbe_ubuntu_clang_libcxx//config:cc-toolchain
build:rbe-toolchain-clang-libc++ --action_env=CC=clang --action_env=CXX=clang++ --action_env=PATH=/usr/sbin:/usr/bin:/sbin:/bin:/opt/llvm/bin
Expand All @@ -162,7 +167,13 @@ build:rbe-toolchain-msan --linkopt=-L/opt/libcxx_msan/lib
build:rbe-toolchain-msan --linkopt=-Wl,-rpath,/opt/libcxx_msan/lib
build:rbe-toolchain-msan --config=clang-msan

build:rbe-toolchain-tsan --linkopt=-L/opt/libcxx_tsan/lib
build:rbe-toolchain-tsan --linkopt=-Wl,-rpath,/opt/libcxx_tsan/lib
build:rbe-toolchain-tsan --config=clang-tsan

build:rbe-toolchain-gcc --config=rbe-toolchain
build:rbe-toolchain-gcc --platforms=@rbe_ubuntu_gcc//config:platform
build:rbe-toolchain-gcc --host_platform=@rbe_ubuntu_gcc//config:platform
build:rbe-toolchain-gcc --crosstool_top=@rbe_ubuntu_gcc//cc:toolchain
build:rbe-toolchain-gcc --extra_toolchains=@rbe_ubuntu_gcc//config:cc-toolchain

Expand Down Expand Up @@ -206,7 +217,7 @@ build:remote-msvc-cl --config=rbe-toolchain-msvc-cl

# Docker sandbox
# NOTE: Update this from https://github.com/envoyproxy/envoy-build-tools/blob/master/toolchains/rbe_toolchains_config.bzl#L8
build:docker-sandbox --experimental_docker_image=envoyproxy/envoy-build-ubuntu:f21773ab398a879f976936f72c78c9dd3718ca1e
build:docker-sandbox --experimental_docker_image=envoyproxy/envoy-build-ubuntu:736b8db2e1f0b55edb50719d2f8ddf383f46030b
build:docker-sandbox --spawn_strategy=docker
build:docker-sandbox --strategy=Javac=docker
build:docker-sandbox --strategy=Closure=docker
Expand All @@ -228,6 +239,10 @@ build:docker-msan --config=docker-sandbox
build:docker-msan --config=rbe-toolchain-clang-libc++
build:docker-msan --config=rbe-toolchain-msan

build:docker-tsan --config=docker-sandbox
build:docker-tsan --config=rbe-toolchain-clang-libc++
build:docker-tsan --config=rbe-toolchain-tsan

# CI configurations
build:remote-ci --remote_cache=grpcs://remotebuildexecution.googleapis.com
build:remote-ci --remote_executor=grpcs://remotebuildexecution.googleapis.com
Expand Down Expand Up @@ -266,6 +281,7 @@ build:windows --define manual_stamp=manual_stamp
build:windows --copt="-DCARES_STATICLIB"
build:windows --copt="-DNGHTTP2_STATICLIB"
build:windows --copt="-DCURL_STATICLIB"
build:windows --cxxopt="/std:c++17"

# Required to work around build defects on Windows MSVC cl
# Unguarded gcc pragmas in quiche are not recognized by MSVC
Expand Down Expand Up @@ -295,4 +311,4 @@ build:windows --features=static_link_msvcrt
build:windows --dynamic_mode=off

try-import %workspace%/clang.bazelrc
try-import %workspace%/user.bazelrc
try-import %workspace%/user.bazelrc
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.1.0
3.3.1
14 changes: 8 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
references:
envoy-build-image: &envoy-build-image # July 1st, 2020
envoyproxy/envoy-build-ubuntu:f21773ab398a879f976936f72c78c9dd3718ca1e
envoy-build-image: &envoy-build-image # July 17th, 2020
envoyproxy/envoy-build-ubuntu:736b8db2e1f0b55edb50719d2f8ddf383f46030b
version: 2
jobs:
build:
Expand All @@ -24,13 +24,13 @@ jobs:
steps:
- checkout
- run: ci/do_ci.sh clang_tidy
test_with_valgrind:
test_gcc:
docker:
- image: *envoy-build-image
resource_class: xlarge
steps:
- checkout
- run: ci/do_ci.sh test_with_valgrind
- run: ci/do_ci.sh test_gcc
coverage:
docker:
- image: *envoy-build-image
Expand All @@ -57,7 +57,9 @@ jobs:
resource_class: xlarge
steps:
- checkout
- run: ci/do_ci.sh asan
- run:
command: ci/do_ci.sh asan
no_output_timeout: 30m
tsan:
docker:
- image: *envoy-build-image
Expand Down Expand Up @@ -88,8 +90,8 @@ workflows:
jobs:
- build
- test
- test_gcc
- clang_tidy
# - test_with_valgrind
- coverage
- asan
- tsan
Expand Down
2 changes: 1 addition & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Checks: 'clang-diagnostic-*,clang-analyzer-*,abseil-*,bugprone-*,modernize-*,performance-*,readability-redundant-*,readability-braces-around-statements,-abseil-no-internal-dependencies,-modernize-use-trailing-return-type,-modernize-avoid-bind'
Checks: 'clang-diagnostic-*,clang-analyzer-*,abseil-*,bugprone-*,modernize-*,performance-*,readability-redundant-*,readability-braces-around-statements,-abseil-no-internal-dependencies,-modernize-use-trailing-return-type,-modernize-avoid-bind,-modernize-use-nodiscard,-modernize-concat-nested-namespaces'

WarningsAsErrors: '*'

Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ tools/pyformat
test/coverage/BUILD
*.bak
default.profraw
tmp-*
tmp-*
1 change: 1 addition & 0 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ envoy_cc_binary(
name = "nighthawk_test_server",
repository = "@envoy",
deps = [
"//source/server:http_dynamic_delay_filter_config",
"//source/server:http_test_server_filter_config",
"@envoy//source/exe:envoy_main_entry_lib",
],
Expand Down
20 changes: 19 additions & 1 deletion api/server/response_options.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,31 @@ package nighthawk.server;
import "google/protobuf/wrappers.proto";
import "validate/validate.proto";
import "envoy/api/v2/core/base.proto";
import "google/protobuf/duration.proto";

// Options that control the test server response.
message ConcurrencyBasedLinearDelay {
// Minimal delay to add to replies.
google.protobuf.Duration minimal_delay = 1 [(validate.rules).duration.gte.nanos = 0];
// Factor to use when adding latency as concurrency increases.
google.protobuf.Duration concurrency_delay_factor = 2 [(validate.rules).duration.gte.nanos = 0];
}

// Options that control the test server response. Can be provided via request
// headers as well as via static file-based configuration. In case both are
// provided, a merge will happen, in which case the header-provided
// configuration will override.
message ResponseOptions {
// List of additional response headers.
repeated envoy.api.v2.core.HeaderValueOption response_headers = 1;
// Number of 'a' characters in the the response body.
uint32 response_body_size = 2 [(validate.rules).uint32 = {lte: 4194304}];
// If true, then echo request headers in the response body.
bool echo_request_headers = 3;

oneof oneof_delay_options {
// Static delay duration.
google.protobuf.Duration static_delay = 4 [(validate.rules).duration.gte.nanos = 0];
// Concurrency based linear delay configuration.
ConcurrencyBasedLinearDelay concurrency_based_linear_delay = 5;
}
}
8 changes: 4 additions & 4 deletions bazel/repositories.bzl
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

ENVOY_COMMIT = "f6b86a58b264b46a57d71a9b3b0989b2969df408" # July 2nd, 2020
ENVOY_SHA = "5c802266f0cdc5193b6e0247a0f5f20f39f6cc36b688b194e60a853148ba438a"
ENVOY_COMMIT = "13da8f415c372e7fde3b0105f58f57348e84acb5" # July 17th, 2020
ENVOY_SHA = "525307fb73125c8c6e4ce4761c9f09b781cd7b7602a8711afe07be45ad55de52"

HDR_HISTOGRAM_C_VERSION = "0.9.13" # Feb 22nd, 2020
HDR_HISTOGRAM_C_SHA = "2bd4a4631b64f2f8cf968ef49dd03ff3c51b487c3c98a01217ae4cf4a35b8310"
HDR_HISTOGRAM_C_VERSION = "0.11.0" # July 14th, 2020
HDR_HISTOGRAM_C_SHA = "c00696b3d81776675aa2bc62d3642e31bd8a48cc9619c9bd7d4a78762896e353"

def nighthawk_dependencies():
http_archive(
Expand Down
3 changes: 3 additions & 0 deletions benchmarks/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ py_binary(
srcs = [
"benchmarks.py",
],
srcs_version = "PY2AND3",
deps = [
":benchmarks_envoy_proxy_lib",
"//test/integration:integration_test_base_lean",
Expand All @@ -20,6 +21,7 @@ py_test(
"test/test_discovery.py",
],
main = "benchmarks.py",
srcs_version = "PY2AND3",
deps = [
":benchmarks_envoy_proxy_lib",
"//test/integration:integration_test_base",
Expand All @@ -35,4 +37,5 @@ py_library(
"configurations/envoy_proxy.yaml",
"test/templates/simple_plot.html",
],
srcs_version = "PY2AND3",
)
28 changes: 13 additions & 15 deletions benchmarks/envoy_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,12 @@ def __init__(self, config_template_path, server_ip, ip_version, parameters=dict(
tag: String. Supply this to get recognizeable output locations (optional).
"""
# If no explicit envoy path is passed, we'll use nighthawk_test_server.
super(EnvoyProxyServer, self).__init__(
os.getenv("ENVOY_PATH", "nighthawk_test_server"),
config_template_path,
server_ip,
ip_version,
parameters=parameters,
tag=tag)
super(EnvoyProxyServer, self).__init__(os.getenv("ENVOY_PATH", "nighthawk_test_server"),
config_template_path,
server_ip,
ip_version,
parameters=parameters,
tag=tag)
self.docker_image = os.getenv("ENVOY_DOCKER_IMAGE_TO_TEST", "")


Expand Down Expand Up @@ -83,15 +82,14 @@ def setUp(self):
# TODO(oschaaf): how should this interact with multiple backends?
self.parameters["proxy_ip"] = self.test_server.server_ip
self.parameters["server_port"] = self.test_server.server_port
proxy_server = EnvoyProxyServer(
self._proxy_config,
self.server_ip,
self.ip_version,
parameters=self.parameters,
tag=self.tag)
proxy_server = EnvoyProxyServer(self._proxy_config,
self.server_ip,
self.ip_version,
parameters=self.parameters,
tag=self.tag)
assert (proxy_server.start())
logging.info("envoy proxy listening at {ip}:{port}".format(
ip=proxy_server.server_ip, port=proxy_server.server_port))
logging.info("envoy proxy listening at {ip}:{port}".format(ip=proxy_server.server_ip,
port=proxy_server.server_port))
self.proxy_server = proxy_server

def tearDown(self):
Expand Down
15 changes: 7 additions & 8 deletions benchmarks/test/test_discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import os
from test.integration.integration_test_fixtures import (http_test_server_fixture,
https_test_server_fixture)
from test.integration import utility
from test.integration import asserts
from envoy_proxy import (inject_envoy_http_proxy_fixture, proxy_config)
from rules_python.python.runfiles import runfiles
from shutil import copyfile
Expand Down Expand Up @@ -49,11 +49,11 @@ def _run_benchmark(fixture,
connection_counter = "upstream_cx_http1_total"

# Some arbitrary sanity checks
utility.assertCounterGreaterEqual(counters, "benchmark.http_2xx",
asserts.assertCounterGreaterEqual(counters, "benchmark.http_2xx",
(concurrency * rps * duration) * 0.99)
utility.assertGreater(counters["upstream_cx_rx_bytes_total"], response_count * response_size)
utility.assertGreater(counters["upstream_cx_tx_bytes_total"], request_count * request_body_size)
utility.assertCounterEqual(counters, connection_counter, concurrency * max_connections)
asserts.assertGreater(counters["upstream_cx_rx_bytes_total"], response_count * response_size)
asserts.assertGreater(counters["upstream_cx_tx_bytes_total"], request_count * request_body_size)
asserts.assertCounterEqual(counters, connection_counter, concurrency * max_connections)

# Could potentially set thresholds on acceptable latency here.

Expand All @@ -76,9 +76,8 @@ def _run_benchmark(fixture,
with open(os.path.join(fixture.test_server.tmpdir, "proxy_version.txt"), "w") as f:
f.write(fixture.proxy_server.getCliVersionString())
r = runfiles.Create()
copyfile(
r.Rlocation("nighthawk/benchmarks/test/templates/simple_plot.html"),
os.path.join(fixture.test_server.tmpdir, "simple_plot.html"))
copyfile(r.Rlocation("nighthawk/benchmarks/test/templates/simple_plot.html"),
os.path.join(fixture.test_server.tmpdir, "simple_plot.html"))


# Test via injected Envoy
Expand Down
Loading