CHttpExec Extension

I have been recently working on CHttp which is a tool to send HTTP requests and to measure the performance of REST APIs.

The primary goal of the tool is the ability to measure GET HTTP requests using version HTTP/2 and HTTP/3. As the tool is based on .NET (currently version 9), it requires a reasonably up-to-date Windows installation or the libmsquic package in case of Linux.

The tool exists of 3 components

  • CHttp

  • Chttp Visual Studio Code Extension

  • CHttpExec

The standalone CHttp tool can be installed from GitHub, as a dotnet tool by using the dotnet tool install -g LaDeak.CHttp --prerelease command or as a Visual Studio Code Extension. I have explored the Chttp Visual Studio Code Extension in a recent post.

In this post I will look into CHttpExec tool. CHttpExec is tool that execute HTTP queries and HTTP performance measurements from a .chttp file.

Installation

dotnet tool install -g LaDeak.CHttpExec --prerelease

This can be useful to execute it on CI server or on a test infrastructure. When using the tool make sure that both the test target and the test executor machines are consistent in the available resources term, and no other concurrent apps share these resources during the performance measuremnt. This includes the network between the target server and the test executor.

Some automation infrastructure providers (such as GitHub Actions) might provide inconsistent amount of resources for different jobs.

Invoke the CLI as:

chttpexec Http3Tools\tests\test.chttp

Attributing the chttp file to assert performance requirements

A performance request can be attributed with # @assert expressions:

# @name validation
# @clientsCount 10
# @requestCount 100
# @assert mean < 1s stddev < 0.5s requestSec >= 0 throughput > 0 successStatus == 100
GET https://{{baseUrl}}/echo HTTP/2

{{nextRequest}}

Possible parameters to assert:

  • mean

  • stddev

  • error

  • median

  • min

  • max

  • throughput

  • requestsec

  • percentile95th

  • successStatus (the number of successful responses)

Values measured in time can be quantified by s ms us or ns. Values without a quantifier are processed as seconds.

Violations are reported as:

ASSERTION VIOLATION
error: Mean is not < 1.000ns
error: StdDev is not < 0.001ns

Note that the tool handles variables the same way as the VSCE extension file does. Variables and their values use reference semantics.