Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update our Envoy dependency #101

Closed
wants to merge 33 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
732b1be
save state
oschaaf Jul 15, 2019
18197fb
save state
oschaaf Jul 15, 2019
8a14b8b
save state
oschaaf Jul 15, 2019
1f43db6
envoy 9e3871ade779664ffb0a8f09b11688878253a082
oschaaf Jul 18, 2019
d1d7f78
Update to Envoy bcc66c6b74c365d1d2834cfe15b847ae13be0eb6
oschaaf Jul 18, 2019
c84d146
poc for embedding python in the c++ bm test
oschaaf Jul 23, 2019
fe671c8
save state
oschaaf Jul 23, 2019
9dd32b4
save state
oschaaf Jul 24, 2019
b05575c
Formatting fixes
oschaaf Jul 24, 2019
4cc57bf
accidental whitespace
oschaaf Jul 24, 2019
b84f137
revert whitespace
oschaaf Jul 24, 2019
00fe42d
Rip out the python c-api
oschaaf Jul 24, 2019
b50fda5
Dep & CI update
oschaaf Jul 25, 2019
dd55512
Enable all tests
oschaaf Jul 25, 2019
f0b16f3
do_ci.sh: add install_virtualenv()
oschaaf Jul 25, 2019
a80e89e
Fix cpp vs python vs pip in CI
oschaaf Jul 25, 2019
d4e8442
Tidy up
oschaaf Jul 25, 2019
9e556e9
Coverage test update
oschaaf Jul 26, 2019
a62e152
Merge remote-tracking branch 'upstream/master' into update-envoy-stat…
oschaaf Jul 26, 2019
32d2d4c
Bump coverage threshold to 97.5
oschaaf Jul 26, 2019
401306e
Fix asan issue + a couple of tweaks
oschaaf Jul 26, 2019
95166d0
back out remote cache in .bazelrc
oschaaf Jul 26, 2019
07d6f65
Update Envoy to the latest.
oschaaf Jul 29, 2019
9b9b567
Update Envoy
oschaaf Jul 29, 2019
d4c8857
Coverage: explicit ipv4 only (test for fixing CI)
oschaaf Jul 29, 2019
958d193
Update Envoy & coverage threshold
oschaaf Jul 31, 2019
39f11d2
Merge branch 'update-envoy-state-dump' of github.com:oschaaf/nighthaw…
oschaaf Jul 31, 2019
53ae490
Add include
oschaaf Jul 31, 2019
e7f33c4
Cover ssl shims in tests
oschaaf Aug 1, 2019
e2ff84d
Adress CI issues
oschaaf Aug 1, 2019
b95ce2d
Coverage fixes
oschaaf Aug 1, 2019
4f44f51
Set coverage threshold to 97.0
oschaaf Aug 1, 2019
0d73cfe
A couple of small cleanups
oschaaf Aug 1, 2019
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
67 changes: 63 additions & 4 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -1,17 +1,28 @@
# The following .bazelrc content is forked from the main Envoy repository. This is necessary since
# The following .bazelrc content is forked from the main Envoy repository. This is necessary since
# this needs to be available before we can access the Envoy repository contents via Bazel.

# Envoy specific Bazel build/test options.

# Bazel doesn't need more than 200MB of memory based on memory profiling:
# Bazel doesn't need more than 200MB of memory for local build based on memory profiling:
# https://docs.bazel.build/versions/master/skylark/performance.html#memory-profiling
# The default JVM max heapsize is 1/4 of physical memory up to 32GB which could be large
# enough to consume all memory constrained by cgroup in large host, which is the case in CircleCI.
# Limiting JVM heapsize here to let it do GC more when approaching the limit to
# leave room for compiler/linker.
startup --host_jvm_args=-Xmx512m
# The number 2G is choosed heuristically to both support in CircleCI and large enough for RBE.
# Startup options cannot be selected via config.
startup --host_jvm_args=-Xmx2g

build --workspace_status_command=bazel/get_workspace_status
build --experimental_remap_main_repo
build --experimental_local_memory_estimate
build --host_force_python=PY2
build --action_env=BAZEL_LINKLIBS=-l%:libstdc++.a
build --action_env=BAZEL_LINKOPTS=-lm:-static-libgcc

# Basic ASAN/UBSAN that works for gcc
build:asan --action_env=BAZEL_LINKLIBS=
build:asan --action_env=BAZEL_LINKOPTS=-lstdc++:-lm
build:asan --define ENVOY_CONFIG_ASAN=1
build:asan --copt -fsanitize=address,undefined
build:asan --linkopt -fsanitize=address,undefined
Expand Down Expand Up @@ -43,6 +54,7 @@ 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 --linkopt -static-libsan
build:clang-tsan --define tcmalloc=disabled
# Needed due to https://github.com/libevent/libevent/issues/777
build:clang-tsan --copt -DEVENT__DISABLE_DEBUG_MODE
Expand All @@ -61,8 +73,55 @@ build:clang-msan --copt -fsanitize-memory-track-origins=2
build:libc++ --action_env=CC
build:libc++ --action_env=CXX
build:libc++ --action_env=CXXFLAGS=-stdlib=libc++
build:libc++ --action_env=BAZEL_CXXOPTS=-stdlib=libc++
build:libc++ --action_env=BAZEL_LINKLIBS=-l%:libc++.a:-l%:libc++abi.a:-lm
build:libc++ --action_env=PATH
build:libc++ --host_linkopt=-fuse-ld=lld
build:libc++ --define force_libcpp=enabled

# Optimize build for binary size reduction.
build:sizeopt -c opt --copt -Os

# Test options
test --test_env=HEAPCHECK=normal --test_env=PPROF_PATH
build --test_env=HEAPCHECK=normal --test_env=PPROF_PATH

# Remote execution: https://docs.bazel.build/versions/master/remote-execution.html
build:rbe-toolchain --host_javabase=@rbe_ubuntu_clang//java:jdk
build:rbe-toolchain --javabase=@rbe_ubuntu_clang//java:jdk
build:rbe-toolchain --host_java_toolchain=@bazel_tools//tools/jdk:toolchain_hostjdk8
build:rbe-toolchain --java_toolchain=@bazel_tools//tools/jdk:toolchain_hostjdk8
build:rbe-toolchain --host_platform=@envoy//bazel/toolchains:rbe_ubuntu_clang_platform
build:rbe-toolchain --platforms=@envoy//bazel/toolchains:rbe_ubuntu_clang_platform
build:rbe-toolchain --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1
build:rbe-toolchain --crosstool_top=@rbe_ubuntu_clang//cc:toolchain
build:rbe-toolchain --extra_toolchains=@rbe_ubuntu_clang//config:cc-toolchain
build:rbe-toolchain --linkopt=-fuse-ld=lld
build:rbe-toolchain --action_env=CC=clang --action_env=CXX=clang++ --action_env=PATH=/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/llvm-8/bin

build:remote --spawn_strategy=remote,sandboxed,local
build:remote --strategy=Javac=remote,sandboxed,local
build:remote --strategy=Closure=remote,sandboxed,local
build:remote --strategy=Genrule=remote,sandboxed,local
build:remote --remote_timeout=3600
build:remote --auth_enabled=true
build:remote --experimental_inmemory_jdeps_files
build:remote --experimental_inmemory_dotd_files
build:remote --experimental_remote_download_outputs=toplevel
test:remote --experimental_remote_download_outputs=minimal

build:remote-clang --config=remote
build:remote-clang --config=rbe-toolchain

# Docker sandbox
build:docker-sandbox --experimental_docker_image=envoyproxy/envoy-build:cfc514546bc0284536893cca5fa43d7128edcd35
build:docker-sandbox --spawn_strategy=docker
build:docker-sandbox --strategy=Javac=docker
build:docker-sandbox --strategy=Closure=docker
build:docker-sandbox --strategy=Genrule=docker
build:docker-sandbox --define=EXECUTOR=remote
build:docker-sandbox --experimental_docker_verbose
build:docker-sandbox --experimental_enable_docker_sandbox

build:docker-clang --config=docker-sandbox
build:docker-clang --config=rbe-toolchain

2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
references:
envoy-build-image: &envoy-build-image
envoyproxy/envoy-build:d0cefa7f071dbd4ef24399c2db8656c3a5d8c3ef
envoyproxy/envoy-build:8246167b9d238797cbc6c03dccc9e3921c37617d

version: 2
jobs:
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ generated/
.cmake
.rnd
.vscode/
venv/*
bazel.output.txt
envoy/
*.pyc
__pycache__
tools/pyformat
tools/pyformat
test/coverage/BUILD
17 changes: 6 additions & 11 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,21 @@ load("//bazel:repositories.bzl", "nighthawk_dependencies")

nighthawk_dependencies()

load("@envoy//bazel:api_binding.bzl", "envoy_api_binding")

envoy_api_binding()

load("@envoy//bazel:api_repositories.bzl", "envoy_api_dependencies")

envoy_api_dependencies()

load("@envoy//bazel:repositories.bzl", "envoy_dependencies")
load("@envoy//bazel:cc_configure.bzl", "cc_configure")

envoy_dependencies()

cc_configure()

load("@rules_foreign_cc//:workspace_definitions.bzl", "rules_foreign_cc_dependencies")

rules_foreign_cc_dependencies()

load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")

go_rules_dependencies()
load("@envoy//bazel:dependency_imports.bzl", "envoy_dependency_imports")

go_register_toolchains()
envoy_dependency_imports()

# For PIP support:
load("@io_bazel_rules_python//python:pip.bzl", "pip_import", "pip_repositories")
Expand Down
4 changes: 2 additions & 2 deletions bazel/repositories.bzl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

ENVOY_COMMIT = "2f569b9a8d3f0d7a43ffa69e3e5ba947cd3a9f8b"
ENVOY_SHA = "ec47fee6604468bc392937967415c736f19fb22129929881270a1635ad216d87"
ENVOY_COMMIT = "bdd6788f1e01787d015eabd9902f4b565e5dea98"
ENVOY_SHA = "a53022b5c985e4c8bb999f2bed40f66a8621aea44312c8fe2fee6d65cd824da8"

RULES_PYTHON_COMMIT = "fdbb17a4118a1728d19e638a5291b4c4266ea5b8"
RULES_PYTHON_SHA = "9a3d71e348da504a9c4c5e8abd4cb822f7afb32c613dc6ee8b8535333a81a938"
Expand Down
24 changes: 13 additions & 11 deletions ci/do_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export BUILDIFIER_BIN="/usr/local/bin/buildifier"

function do_build () {
bazel build $BAZEL_BUILD_OPTIONS --verbose_failures=true //:nighthawk_client //:nighthawk_test_server \
//:nighthawk_service
//:nighthawk_service
}

function do_test() {
Expand All @@ -27,7 +27,17 @@ function do_clang_tidy() {
}

function do_coverage() {
ci/run_coverage.sh
setup_clang_toolchain
echo "bazel coverage build with tests ${TEST_TARGETS}"

# Reduce the amount of memory Bazel tries to use to prevent it from launching too many subprocesses.
# This should prevent the system from running out of memory and killing tasks. See discussion on
# https://github.com/envoyproxy/envoy/pull/5611.
[ -z "$CIRCLECI" ] || export BAZEL_BUILD_OPTIONS="${BAZEL_BUILD_OPTIONS} --local_ram_resources=12288"

export TEST_TARGETS="//test/..."
test/run_envoy_bazel_coverage.sh ${TEST_TARGETS}
exit 0
}

function setup_gcc_toolchain() {
Expand Down Expand Up @@ -96,14 +106,10 @@ if [ -n "$CIRCLECI" ]; then
mv "${HOME:-/root}/.gitconfig" "${HOME:-/root}/.gitconfig_save"
echo 1
fi

NUM_CPUS=8
if [ "$1" == "coverage" ]; then
NUM_CPUS=6
fi
fi

if grep 'docker\|lxc' /proc/1/cgroup; then
if grep 'docker\|lxc' /proc/1/cgroup; then
# Create a fake home. Python site libs tries to do getpwuid(3) if we don't and the CI
# Docker image gets confused as it has no passwd entry when running non-root
# unless we do this.
Expand Down Expand Up @@ -136,10 +142,6 @@ export BAZEL_TEST_OPTIONS="${BAZEL_BUILD_OPTIONS} --test_env=HOME --test_env=PYT

setup_clang_toolchain

if [ "$1" == "coverage" ]; then
setup_gcc_toolchain
fi

case "$1" in
build)
do_build
Expand Down
46 changes: 0 additions & 46 deletions ci/run_coverage.sh

This file was deleted.

3 changes: 2 additions & 1 deletion include/nighthawk/client/benchmark_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ class BenchmarkClient {
/**
* Initialize will be called on the worker thread after it has started.
* @param runtime to be used during initialization.
* @param thread local storage to be used.
*/
virtual void initialize(Envoy::Runtime::Loader& runtime) PURE;
virtual void initialize(Envoy::Runtime::Loader& runtime, Envoy::ThreadLocal::Instance& tls) PURE;

/**
* Terminate will be called on the worker thread before it ends.
Expand Down
31 changes: 26 additions & 5 deletions integration/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ load("@python_pip_deps//:requirements.bzl", "requirement")

envoy_package()

py_test(
name = "integration_test",
py_library(
name = "integration_test_base",
srcs = [
"integration_test.py",
"common.py",
"integration_test_fixtures.py",
"nighthawk_test_server.py",
],
data = [
"configurations/nighthawk_http_origin.yaml",
Expand All @@ -20,8 +22,6 @@ py_test(
"//:nighthawk_test_server",
"@envoy//test/config/integration/certs",
],
python_version = "PY3",
srcs_version = "PY3ONLY",
deps = [
requirement("requests"),
# The following are implied by 'request'.
Expand All @@ -31,3 +31,24 @@ py_test(
requirement("idna"),
],
)

py_binary(
name = "cpp_benchmark_client_server",
srcs = [
"cpp_benchmark_client_server.py",
],
deps = [
":integration_test_base",
],
)

py_test(
name = "integration_test",
srcs = [
"integration_test.py",
"test_integration_basics.py",
],
deps = [
":integration_test_base",
],
)
58 changes: 58 additions & 0 deletions integration/cpp_benchmark_client_server.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/usr/bin/env python3
"""@package integration_test.py
Entry point for our integration testing
"""

import logging
import os
import sys
import unittest

from common import IpVersion, NighthawkException
from integration_test_fixtures import (HttpIntegrationTestBase, HttpsIntegrationTestBase,
IntegrationTestBase)

assert sys.version_info >= (3, 0)

httpbase = None


def serverStartHook(ip_version, is_https):
IntegrationTestBase.ip_version = ip_version
logging.basicConfig(stream=sys.stderr, level=logging.DEBUG)
global httpbase

if is_https:
httpbase = HttpsIntegrationTestBase()
httpbase.overrideTestServerConfigPath("test/test_data/benchmark_https_client_test_envoy.yaml")
else:
httpbase = HttpIntegrationTestBase()
httpbase.overrideTestServerConfigPath("test/test_data/benchmark_http_client_test_envoy.yaml")

httpbase.setUp()
return httpbase.server_port


def getRunningServerPid():
return httpbase.getServerPid()


def waitForExit():
return httpbase.waitForServerExit()


def main():
if len(sys.argv) != 3:
print("cpp_benchmark_client_server.py [ipv4|ipv6] [http|https]")
return -1
port = serverStartHook(
IpVersion.IPV6 if str.lower(sys.argv[1]) == "ipv6" else IpVersion.IPV4,
str.lower(sys.argv[2]) == "https")
print(str(port))
print(str(getRunningServerPid()))
sys.stdout.flush()
return waitForExit()


if __name__ == '__main__':
main()
Loading