Conversation
… body
Nighthawk could only send a synthetic body ('a' repeated --request-body-size
times) or, through a request source plugin, a UTF-8 json_body string. Add
--request-body-file, which reads the whole file and sends its bytes
verbatim on every request (binary safe), carried over the gRPC service API
in the new RequestOptions.request_body bytes field. Content-Length is set
from the body size; no Content-Type is assumed, supply one with
--request-header. Mutually exclusive with --request-body-size.
StaticRequestSourceImpl gains an optional body so the static request source
can yield it; the plugin and remote request sources are unchanged.
Signed-off-by: Bruno Palermo <bruno.palermo@superbid.net>
Nighthawk had no gRPC awareness: a request with a gRPC body had to be assembled by hand and a failed RPC (HTTP 200 + grpc-status 13) counted as a 2xx success because decodeTrailers() only kept trailers for tracing. --grpc-mode unary issues gRPC unary calls: - implies --protocol http2 (h2c prior knowledge on http:// URIs) and --request-method POST; sets content-type: application/grpc and te: trailers; no content-length; - wraps the --request-body-file bytes (a serialized protobuf message) in the gRPC length-prefixed frame, so users supply only the message; - the method comes from the URI path (/pkg.Service/Method), or a :path request header; - reads grpc-status from the trailers, or from the headers on trailers-only responses. Status 0 is a success and feeds the new benchmark_http_client.latency_grpc_ok statistic; any other or missing status increments benchmark.grpc_error and benchmark.grpc_status.<code> (.missing when absent) and is not counted as benchmark.http_2xx. HTTP level counters and latency_* statistics keep their meaning. StreamDecoderCompletionCallback::onComplete()/exportLatency() now pass the observed grpc-status through. Fixes envoyproxy#24 for unary calls; streaming is a follow-up: --grpc-mode is an enum-valued flag (GrpcMode in options.proto) so that streaming becomes --grpc-mode bidi-stream rather than a second boolean flag. Signed-off-by: Bruno Palermo <bruno.palermo@superbid.net>
f15a435 to
90959c4
Compare
Keeps the branch mergeable after the Envoy bump to 82c182e, the envoy_package additions and envoyproxy#1598 landing. The only conflict was the version history changelist, where both sides add a bullet; both are kept. Signed-off-by: Bruno Palermo <bruno.palermo@superbid.net>
Second update in a row: envoyproxy#1599 landed while this branch was being brought up to date. Conflicts were all "both sides added something in the same place": - toCommandLineOptionsInternal(): envoyproxy#1599 hoisted the request_body_size emission out of the request header loop, this branch added the request_body emission next to it. Both are kept; an explicitly emitted request_body_size of 0 does not trip the exclusivity check in validate(), which tests request_body_size_ > 0. - options_test.cc and the version history changelist: both sides append their own test / bullet, both are kept. Signed-off-by: Bruno Palermo <bruno.palermo@superbid.net>
Picks up upstream main (Envoy 82c182e, envoy_package, envoyproxy#1598, envoyproxy#1599) through the branch this one is stacked on. Both conflicts were each side appending its own test case / changelist bullet in the same place; both sides kept. Signed-off-by: Bruno Palermo <bruno.palermo@superbid.net>
|
In case we don't have the cycles to review the gRPC PRs in the next weeks, I wanted to let you know about another option that might make it easier to work in the short term, at least for unary gRPC. You might be able to:
Of course this approach would be missing the capability to inspect the gRPC response and update gRPC-specific counters. |
Appreciate, I will try it in the meanwhile, thanks! fwiw I already have this working in a fork. |
envoyproxy#1601 was squash merged, so main carries the --request-body-file change as a single commit while this branch still carries its originals. Every conflict was this branch's unary additions against main's post squash text, with no hunk where main had content this branch lacked, so each was resolved in favour of this branch. The version history changelist keeps main's entries plus this branch's. Signed-off-by: Bruno Palermo <b@palermo.dev>
The rename from --grpc to --grpc-mode unary lengthened these argument lists past what yapf leaves alone, so ci/do_ci.sh check_format failed on them. tools/check_format.sh covers C++ and Bazel files only; the Python half is tools/format_python_tools.sh, which CI runs as well. Signed-off-by: Bruno Palermo <b@palermo.dev>
Description
This PR is related to #24
Adds
--grpc-mode unaryfor gRPC unary load generation with grpc-status scoring. Nighthawk has no gRPC awareness today: a gRPC request had to be assembled by hand (framing, headers), and a failed RPC that comes back as HTTP 200 withgrpc-status: 13is counted ashttp_2xxbecausedecodeTrailers()only keeps trailers for the tracing span.--grpc-mode unary:--protocol http2(h2c prior knowledge onhttp://URIs) and--request-method POST; setscontent-type: application/grpcandte: trailers; noContent-Length.--request-body-filebytes (one serialized protobuf message) in the gRPC length-prefixed frame, so users supply only the message. The method is the URI path, e.g.http://host:8080/pkg.Service/Method(a:pathrequest header still overrides).grpc-statusis read from the trailers, or from the headers on trailers-only responses. Status 0 is a success and feeds the newbenchmark_http_client.latency_grpc_okstatistic; any other or missing status incrementsbenchmark.grpc_errorandbenchmark.grpc_status.<code>(.missingwhen absent) and is not counted asbenchmark.http_2xx. HTTP-level counters andlatency_*statistics keep their meaning, so non-gRPC runs are unaffected.--request-source.Notes for Reviewers
--request-body-file): only the last commit is new here; will be rebased once client: add --request-body-file to send a file's bytes as the request body #1601 merges.StreamDecoderCompletionCallback::onComplete()/exportLatency()gain the observed grpc-status; the response body is consumed and its size recorded as before.//test:stream_decoder_test(status from trailers, trailers-only, trailers override headers, none on plain HTTP),//test:benchmark_http_client_test(accounting per outcome and inert when off),//test:factories_test(headers, framing, no content-length),//test:options_test,test/integration/test_grpc_unary.py(runs against the test server with injectedgrpc-status, including a gRPC-aware Envoy's synthesized status and no status). Verified end to end against a grpc-java server (arm64) to 8k rps with zero errors. README usage regenerated; version history updated.--grpc-modeis an enum-valued flag (GrpcModeinoptions.proto);unaryis the only value here and client: gRPC bidirectional streaming mode (--grpc-mode bidi-stream) #1603 addsbidi-stream, so streaming does not need a second boolean flag.