Nighthawk
A L7 (HTTP/HTTPS/HTTP2) performance characterization tool

Current state
Nighthawk currently offers:
- A load testing client which supports HTTP/1.1 and HTTP/2 over HTTP and HTTPS.
(HTTPS certificates are not yet validated).
- A simple test server which is capable of generating dynamic response sizes, as well as inject delays.
- A binary to transform nighthawk output to well-known formats, allowing integration with other systems and dashboards.
Navigating the codebase
See navigating the codebase for a
description of the directory structure.
Additional Documentation
See the howto directory for documentation aimed at specific
use-cases.
Building Nighthawk
Prerequisites
Note that Nighthawk uses Envoy's code
directly, so building Envoy is a prerequisite for building Nighthawk. Start by
looking at Envoy's
building
documentation.
Compiler requirements
The main supported way of building Nighthawk is with the Clang compiler. At
least Clang/LLVM 12+ is needed to successfully build Nighthawk.
Bazel
Both Envoy and Nighthawk use the Bazel build tool. The
steps required to set up Bazel are documented in Envoy's Quick start Bazel
build for
developers.
Building on Ubuntu
This section outlines the steps needed to build on Ubuntu. Note that these steps
include commands that are documented in the prerequisites section above.
Install required packages
Run the following command to install the required packages.
sudo apt-get install \
autoconf \
automake \
cmake \
curl \
libtool \
make \
ninja-build \
patch \
python3-pip \
unzip \
virtualenv
Install Clang/LLVM
Note that depending on the chosen Ubuntu version, you may need to manually
install a never version of Clang/LLVM. The installed version of Clang can be
verified by running:
If you do need to install a newer version, be sure to use Ubuntu's
update-alternatives or a similar approach to switch to using the newer
Clang/LLVM. See issue#832
for one possible approach.
Run the following commands to install Clang/LLVM.
sudo apt install -y lld clang llvm lld lldb
sudo apt install -y clang-{format,tidy,tools} clang-doc clang-examples
Install Bazelisk instead of bazel
Bazelisk is recommended, since it
automatically chooses and downloads the appropriate Bazel version. If you
already have Bazel installed, it is strongly recommended to remove it.
Run the following to remove bazel.
sudo apt-get remove bazel
Run the following to install Bazelisk.
sudo wget -O /usr/local/bin/bazel https://github.com/bazelbuild/bazelisk/releases/latest/download/bazelisk-linux-$([ $(uname -m) = "aarch64" ] && echo "arm64" || echo "amd64")
sudo chmod +x /usr/local/bin/bazel
Clone Nighthawk and setup Clang as the compiler
Run the following to clone the Nighthawk repository and instruct Bazel to use
Clang.
git clone https://github.com/envoyproxy/nighthawk
cd nighthawk/
echo "build --config=clang" >> user.bazelrc
Install Python libraries
It is advisable to use the same version of Python as the one listed at the top of tools/base/requirements.txt. While other versions may also work, the chances of success are greatest if using the same one.
Recommended: Use virtualenv to avoid conflicts between Nighthawk's Python package version requirements and other versions already on your system:
python3 -m venv ~/my_nh_venv
source ~/my_nh_venv/bin/activate
Note: Avoid creating the environment under the Nighthawk project directory.
Install Python packages required for Nighthawk (whether using virtualenv or not):
pip3 install --user -r tools/base/requirements.txt
If pip3 install fails, you will need to troubleshoot the Python environment before attempting to build and test Nighthawk.
Build and testing Nighthawk
You can now use the CI script to build Nighthawk.
Or to execute its tests.
Note that after building completes, the Nighthawk binaries are located in the
bazel-bin/ directory located at the root of the cloned Nighthawk repository.
Using the Nighthawk client CLI
For using the Nighthawk test server, see here.
➜ bazel-bin/nighthawk_client --help