Skip to content

Commit 5012578

Browse files
authored
Merge pull request #86 from vinayaksh42/docs-initial
docs initial struct
2 parents 63a3403 + 8898bb4 commit 5012578

File tree

9 files changed

+333
-47
lines changed

9 files changed

+333
-47
lines changed

docs/_includes/header.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
<div class="container nav-container custom-nav-container">
6767
<div class="custom-nav-cont-1">
6868
<li class="nav-item">
69-
<a href="/" class="nav-text active">HOME</a>
69+
<a href="/" class="nav-text">HOME</a>
7070
</li>
7171
<li class="nav-item">
7272
<a href="/docs" class="nav-text">DOCS</a>

docs/_includes/sidebar.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<ul>
2+
<h4>Documentation</h4>
3+
{% for doc in site.docs %}
4+
<li>
5+
<h5 ><a class="doc-link" href="{% include relative-src.html src=doc.url %}">{{ doc.title }}</a></h5>
6+
</li>
7+
{% endfor %}
8+
</ul>
9+

docs/_layouts/doc.html

Lines changed: 0 additions & 29 deletions
This file was deleted.

docs/_layouts/docs.html

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
---
2+
layout: default
3+
---
4+
5+
<html>
6+
<head>
7+
<meta charset="utf-8">
8+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
9+
<title>GetNighthawk</title>
10+
<meta name="description" content="">
11+
<meta name="viewport" content="width=device-width, initial-scale=1">
12+
13+
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
14+
<link href="https://fonts.googleapis.com/css?family=Montserrat|Ubuntu&display=swap" rel="stylesheet">
15+
16+
<link rel="stylesheet" href="{{ site.baseurl }}/assets/css/main.css">
17+
18+
<script src="https://kit.fontawesome.com/2ffe680fa0.js" crossorigin="anonymous"></script>
19+
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BmbxuPwQa2lc/FVzBcNJ7UAyJxM6wuqIj61tLrc4wSX0szH/Ev+nYRRuWlolflfl" crossorigin="anonymous">
20+
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-b5kHyXgcpbZJO/tY9Ul7kGkf1S0CWuKcCD38l8YkeH8z8QjE0GmW1gYU5S9FOnJ0" crossorigin="anonymous"></script>
21+
<script src="https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/umd/popper.min.js" integrity="sha384-KsvD1yqQ1/1+IA7gi3P0tyJcT3vR+NdBTt13hSJ2lnve8agRGXTTyNaBYmCR/Nwi" crossorigin="anonymous"></script>
22+
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" integrity="sha384-nsg8ua9HAw1y0W1btsyWgBklPnCUAFLuTMS2G72MMONqmOymq585AcH49TLBQObG" crossorigin="anonymous"></script>
23+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/fancyapps/[email protected]/dist/jquery.fancybox.min.css" />
24+
<script src="https://cdn.jsdelivr.net/gh/fancyapps/[email protected]/dist/jquery.fancybox.min.js"></script>
25+
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
26+
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
27+
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
28+
</head>
29+
<style>
30+
body{
31+
overflow: hidden;
32+
}
33+
</style>
34+
<br><br><br><br><br><br>
35+
<div class="row">
36+
<div class="col-lg-3">
37+
<nav class="navbar navbar-expand-lg navbar-light">
38+
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
39+
<span class="navbar-toggler-icon"></span>
40+
</button>
41+
42+
<div class="collapse navbar-collapse" id="navbarSupportedContent">
43+
44+
<ul class="sidebar">
45+
<h4 class="doc-heading">Documentation</h4>
46+
{% for doc in site.docs %}
47+
<li>
48+
<h5 ><a class="doc-link" href="{% include relative-src.html src=doc.url %}">{{ doc.title }}</a></h5>
49+
</li>
50+
{% endfor %}
51+
</ul>
52+
</div>
53+
</nav>
54+
</div>
55+
<div class="col-lg-9 container-g">
56+
{{content}}
57+
</div>
58+
</div>

docs/_sass/getnighthawk.scss

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5672,3 +5672,19 @@ a.globalFooterCard.card-environment, div.globalFooterCard.card-environment {
56725672
padding-left: 50px;
56735673
}
56745674
/*# sourceMappingURL=about-44bbf7b0a0c8887c2697.min.css.map*/
5675+
5676+
5677+
/* docs styling */
5678+
.doc-link {
5679+
text-decoration: none;
5680+
margin-left: 20px;
5681+
color: #696969;
5682+
}
5683+
5684+
.sidebar {
5685+
5686+
}
5687+
5688+
.doc-heading {
5689+
margin-left: 20px;
5690+
}
Lines changed: 194 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,196 @@
11
---
2-
layout: doc
3-
title: Using GetNighthawk
2+
layout: docs
3+
title: Overview
44
---
5-
Test 2
5+
# Nighthawk: architecture and key concepts
6+
7+
## High level interaction model
8+
9+
**Process** creates one or more **Workers**. **Worker** will run **Sequencer**,
10+
which in turn queries **RateLimiter** for [request-release
11+
timings](terminology.md#request-release-timings). When it is time to release a
12+
request, **BenchmarkClient** will be requested to do so by **Sequencer**.
13+
**BenchMarkClient** will then ask its underlying **Pool** to create a
14+
**StreamDecoder** for releasing the actual request. **StreamDecoder** will query the
15+
request data it needs to send from the configured **RequestSource**, and send it
16+
off. **StreamDecoder** will emit events as it progresses (pool ready,
17+
completion, etc), and timings will subsequently be recorded into **Statistic**
18+
as well as get bubbled up to **Sequencer** for tracking in-flight work and
19+
**Statistic** bookkeeping.
20+
21+
**Sequencer** will query the configured **TerminationPredicates** to terminate
22+
when and how to terminate execution. When all **Workers** have finished,
23+
**Process** will collect the results from all **Workers** via
24+
**OutputCollector**, and run **OutputFormatter** to transform to the requested
25+
output format.
26+
27+
## Notable upcoming changes
28+
29+
Calling out two new concepts that may get proposed in the future, and cause some
30+
churn in the code base as we inject them.
31+
32+
### Phases
33+
34+
One notable addition / change that may get proposed in the near future is the
35+
introduction of **Phase**. **Phase** would represent a distinct stage of an
36+
execution, for example a warm-up. It would then be useful to have
37+
per-phase reporting of latencies as well as counters and latencies.
38+
39+
Concretely, a warm-up phase could be represented by a distinct duration
40+
termination predicate and a ramping rate limiter. Upon completion, the `hot`
41+
BenchmarkClient with its associated pool would then be live-transferred to the
42+
next configured phase, after which execution can continue.
43+
44+
One other reason to have this is that it would enable remote- and/or cli-
45+
controlled ramping of certain test parameters by associating those to different
46+
phases. Termination predicates can be leveraged to immediately terminate the
47+
current phase after injecting a new one, allowing for real-time steering via
48+
gRPC and/or CLI.
49+
50+
### Streaming parameterization and output stats
51+
52+
Once we have phases, the gRPC service, and perhaps the CLI, would be natural
53+
candidates to follow up with to allow dynamic phase injection, as well as send
54+
back reports per phase.
55+
56+
## Key concept descriptions
57+
58+
*The c++ interface definitions for the concepts below can be found [here](https://github.com/envoyproxy/nighthawk/tree/main/include/nighthawk)*.
59+
60+
### Process
61+
62+
**Process** represents the primary entry point to a Nighthawk execution run.
63+
Only one Process is allowed to exist at the same point in time within an OS
64+
Process. **Process** is responsible for performing process-wide initialization
65+
and termination, as well as handle input configuration, deliver output, and
66+
co-ordinate Workers. **ProcessImpl** is re-used across the CLI and the gRPC
67+
service.
68+
69+
### Worker
70+
71+
**Worker** is responsible for performing correct initialization and termination
72+
of its thread, as well as execution of its designated task and offering a way
73+
for consumers to wait for that task to complete.
74+
75+
### TerminationPredicate
76+
77+
**TerminationPredicate** is responsible for if and how to terminate. As of
78+
today, there are two types: one that will indicate that it is time to terminate
79+
based on a pre-configured duration, and one that will do so based on absolute
80+
counter thresholds.
81+
82+
### Sequencer
83+
84+
**SequencerImpl** resides on a worker-thread, and drives itself via timers that
85+
run on the dispatcher, and coordinates interaction between **RateLimiter,**
86+
**BenchmarkClient**, and **TerminationPredicate** to drive execution to
87+
completion.
88+
89+
### RateLimiter
90+
91+
**RateLimiter** is responsible for indicating when it is time to release a
92+
request. **RateLimiter** offers a semaphore-like interaction model, as in
93+
[closed-loop](terminology.md#closed-loop) mode it may be that
94+
**BenchmarkClient** is not able to satisfy request-release timings, in which
95+
case acquisitions from **RateLimiter** need to be cancelled. Concretely, as of
96+
today there is **LinearRateLimiterImpl** which offers a straight-paced plain
97+
frequency, as well as work in progress on
98+
**DistributionSamplingRateLimiterImpl** (adding uniformly distributed random
99+
timing offsets to an underlying **RateLimiter**) and **LinearRampingRateLimiter**.
100+
101+
### BenchmarkClient
102+
103+
As of today, there’s a single implementation called **BenchmarkClientImpl**,
104+
which wraps Envoy’s **Upstream** concept and (slightly) customized H1/H2
105+
**Pool** concepts. For executing requests, the pool will be requested to create
106+
a **StreamEncoder**, and Nighthawk will pass its own **StreamDecoderImpl** into
107+
that as an argument. The integration surface between **BenchmarkClient** is
108+
defined via `BenchmarkClient::tryStartRequest()` and a callback specification
109+
which will be fired upon completion of a successfully started request.
110+
111+
For H3, it is anticipated that it will fit into this model, but if all else
112+
fails, it will be entirely possible to wire in a new type of
113+
**BenchmarkClient**.
114+
115+
### RequestSource
116+
117+
**RequestSource** is an abstraction that allows us to implement different ways
118+
for **BenchmarkClient** to get information on what the request that it is about
119+
to fire off should look like. Today, two implementations exist: a static one,
120+
which will repeat the same request over and over, as well as one that pulls
121+
dynamic request data from a grpc service. The latter can, for example, be used
122+
to implement log-replay.
123+
124+
### StreamDecoder
125+
126+
**StreamDecoder** is a Nighthawk-specific implementation of an [Envoy
127+
concept](https://github.com/envoyproxy/envoy/blob/3156229006a5340b65c773329070737f67e81826/include/envoy/http/filter.h#L463).
128+
StreamDecoder will by notified by Envoy as headers and body fragments arrive.
129+
The Nighthawk implementation of that is responsible for coordinating lifetime
130+
events of a request to upper abstraction layers (**BenchmarkClient**,
131+
**Sequencer**) as well as recording latency and reporting that upwards.
132+
133+
### OutputCollector
134+
135+
**OutputCollector** is a container that facilitates building up the native output
136+
format of Nighthawk (`proto3`, `nighthawk::client::Output`). It is the basis for all
137+
output formats offered by Nighthawk, including CLI human output.
138+
139+
### OutputFormatter
140+
141+
**OutputFormatter** is responsible for transformations of `nighthawk::client::Output`
142+
to requested formats (e.g. human, json, fortio, etc)
143+
144+
### Statistic
145+
146+
Nighthawk’s **Statistic** is responsible for administrating latencies. The most
147+
notable implementation that exists today wraps
148+
[HdrHistogram](https://github.com/HdrHistogram/HdrHistogram_c), but Nighthawk
149+
also has a couple of other implementations which mostly exist to ensure that
150+
floating point math is correct in tests, as well as a simple efficient
151+
implementation that simply tracks the `mean` and `pstddev` for those cases where
152+
we don't need percentiles. For various reasons, HdrHistogram might get replaced
153+
by [libcirclhist](https://github.com/envoyproxy/nighthawk/issues/115) in the
154+
near future.
155+
156+
### H1Pool & H2Pool
157+
158+
Nighthawk derives its own version of these from the vanilla Envoy ones. It does
159+
that to implement things like pro-active connection pre-fetching and H2
160+
multi-connection support, as well as offer more connection management
161+
strategies.
162+
163+
## Nighthawk binaries
164+
165+
### nighthawk_client
166+
167+
The CLI interface of the Nighthawk client. It synthesizes traffic according
168+
to the requested configuration and report results in the requested output format.
169+
170+
### nighthawk_service
171+
172+
Nighthawk’s gRPC service is able to execute load tests, and report results.
173+
Under the hood it shares much of the code of nighthawk_client, and effectively
174+
it allows to efficiently perform remote back-to-back executions of that.
175+
176+
### nighthawk_test_server
177+
178+
Nighthawk’s test server, based on Envoy. It is able to synthesize delays and
179+
responses based on configuration via request headers (next to on-disk
180+
configuration).
181+
182+
### nighthawk_output_transform
183+
184+
Utility for transforming the nighthawk-native json output format into
185+
other formats (e.g. human, fortio). It can be very useful to always store the
186+
json output format, yet be able to easily get to one of the other output
187+
formats. It’s like having the cake and eating it too!
188+
189+
## User-specified Nighthawk logging
190+
191+
Users of Nighthawk can specify custom format and destination (logging sink
192+
delegate) for all Nighthawk logging messages. Nighthawk utilizes the Envoy's
193+
logging mechanism by performing all logging via the **ENVOY_LOG** macro. To
194+
customize this mechanism, users need to perform two steps:
195+
1. Create a logging sink delegate inherited from [Envoy SinkDelegate](https://github.com/envoyproxy/envoy/blob/main/source/common/common/logger.h).
196+
2. Construct a ServiceImpl object with an [Envoy Logger Context](https://github.com/envoyproxy/envoy/blob/main/source/common/common/logger.h) which contains user-specified log level and format.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
layout: doc
2+
layout: docs
33
title: Using GetNighthawk
44
---
55
Test

docs/index.html

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" integrity="sha384-nsg8ua9HAw1y0W1btsyWgBklPnCUAFLuTMS2G72MMONqmOymq585AcH49TLBQObG" crossorigin="anonymous"></script>
2323
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/fancyapps/[email protected]/dist/jquery.fancybox.min.css" />
2424
<script src="https://cdn.jsdelivr.net/gh/fancyapps/[email protected]/dist/jquery.fancybox.min.js"></script>
25+
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
26+
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
27+
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
2528
</head>
2629
<style>
2730
body{
@@ -113,26 +116,18 @@ <h1 class="desc-h1">Nighthawk and Meshery</h1><br><br>
113116

114117
</div>
115118

116-
<div class="newsletter-signup newsletter-div">
119+
<div class="newsletter-signup newsletter-div container-g">
117120
<div>
118121
<h2 class="why-getnighthawk-h2">
119122
Why GetNighthawk?
120123
</h2>
121124
</div>
122125
<div class="why-getnighthawk-p-div">
123-
<p class="why-getnighthawk-p">
126+
<p >
124127
Nighthawk is growing in popularity, but the core project only builds to one architecture / one
125-
</p>
126-
<p class="why-getnighthawk-p">
127128
Docker image. Recently, Nighthawk is being improved so that it can be horizontally scalable - such
128-
</p>
129-
<p class="why-getnighthawk-p">
130129
that multiple instances will be cognizant of one another and able to coordinate amongst each
131-
</p>
132-
<p class="why-getnighthawk-p">
133130
other. Nighthawk is a subproject of Envoy. Nighthawk is growing in popularity with Google, Red
134-
</p>
135-
<p class="why-getnighthawk-p">
136131
Hat, and AWS are investing into it. Istio is considering switching from Fortio to Nighthawk.
137132
</p>
138133
</div>

0 commit comments

Comments
 (0)