Giter Club home page Giter Club logo

hermes's Introduction

CI Coverage Status Technical Debt

What is hermes?

Hermes is an http/2 traffic generator written in C++ able to send multiplexed requests over one connection at a given rate.

It also measures and calculates some statistics, validates response codes and handles user-defined traffic sequences, a.k.a. scripts.

Because of the nature of the project itself, it has a minimal footprint impact, and has proven to be reliable: traffic is generated in a steady pace, without unwanted traffic bursts. This is achieved by using boost async io_context utility and thread synchronization strategies.

It is based in the nghttp2 implementation, and provides a different functionality than h2load, also written in C++ by the nghttp2 creator, because hermes allows to use traffic scripts, traffic is injected at a pre-defined rate, and validates the results.

Hermes aims to be a low footprint and easy to use but high-performance general use tool.

How can you use it?

Hermes may be used standalone (check the releases!), from a docker container, or as part of a kubernetes deployment.

Executing hermes

You may take a look to Hermes help by just typing ./hermes -h:

hermes: C++ Traffic Generator. Usage:  hermes [options]

options:
       -r <rate>      Requests/second ( Default: 10 )

       -t <time>      Time to run traffic (s) ( Default: 60 )

       -p <period>    Print and save statistics every <period> (s) ( Default: 10 )

       -f <path>      Path with the traffic json definition ( Default: /etc/scripts/traffic.json )

       -s             Show schema for json traffic definition.

       -o <file>      Output file for statistics( Default: hermes.out )

       -h             This help.

At the end of the day a typical use is:

./hermes -r2400 -p1 -t3600

Hermes results, console and file outputs are explained here.

hermes helm chart integration

The idea is simple:

  • Add it to your Chart.yaml dependencies.
  • Reference hermes in your chart under .Values.hermes.image repository and tag.
  • Define a config map for your traffic definition (script) and reference it in your values with the name you gave it under .Values.hermes.script.cm

But what is inside that ConfigMap? Your traffic script definition.

And that's it!

If you have some doubts, take a look at the example-hermes helm chart, or the following examples.

Examples

This repository provides a server-mock implementation which enables you to test and taste easily how hermes works.

Container to Container example

  1. Build and run a server-mock container by following these instructions.
  2. Attach to a docker container running a ghcr.io/jgomezselles/hermes image, and create a script file like the one located in the helm example.
  3. Run hermes providing the path to your new script:
./hermes -r2400 -p1 -t3600 -f <path/to/script.json>

hermes in kubernetes example

  1. Build (but not run) a server-mock by following these instructions.
  2. Update the example-hermes helm chart dependencies, and install the chart:
helm dep update helm/example-hermes
helm install example-hermes helm/example-hermes
  1. Run hermes
kubectl exec <hermes-pod> -c hermes -- /hermes/hermes -p1 -t10 -r1000

The server-mock prints every received request to the console, so you can check the received requests by inspecting the logs: kubectl logs <server-mock-pod>

Developing & testing hermes

Take a look to hermes dev info here.

License

The Software implemented in this repository is distributed under MIT license, as stated in the LICENSE file. It makes use of some boost C++ library functionalities, which have their own license. Hermes core functionality is based on nghttp2, and json handling is done with rapidjson, both under MIT license. Tests are done with Googletest, which is published under BSD 3-Clause License.

hermes's People

Contributors

jgomezselles avatar pepeludev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

hermes's Issues

Execute hermes via h2 requests

Having a server listening for requests which will be able to START an execution will help tests and will add a whole new functionality. In this issue, some very basic PUT will be added.

Fix UT

Test connection_test.incorrect_initialization_wrong_host is failing. Fix it in this task.

Improve testing for files under src/script

It has been noticed that the files under src/script folder are not really tested in a functional way, (just to get the coverage, which is a bit dangerous), so new tasks will be added.

Add application testing

Hermes CI/CD checks shall have a way of testing the application itself. It might be done through helm chart installation and full k8s deployment.

In order for this to work, a server will be introduced, listening to requests. This is not only a way to ease the tests, but also a functionality which could give hermes a lot of power.

Make docker images lighter

Hermes base and build can have some stuff, but maybe it has so much,
We could have hermes_prod with just the app, and hermes_test for component testing or something like that, from a basic alpine(?) image.

Parallel scripts

Running several clients with their own script/traffic and execution configuration (or shared) could be benefitial.

Multiple connections

Analyze and decide whether to use/configure multiple connections with a maximum number of streams to be negociated.

Validate responses

Hermes is only validating response codes. Include body validation as well.

Multiple client endpoints

Is your feature request related to a problem? Please describe.
Not actually a problem, but a limitation which could provide a better testing environment.

Describe the solution you'd like
Extend the schema and the hermes logic to accept multiple clients (a section to define the server and port within a json list) instead of the current unique one.
So, you could define a traffic profile to, for example, launch an specific Request definition through an specific client endpoint (a new field should be added in the schema here to specify on which endpoint is desired to be sent), and then mix with other requests with different destinations.
The solution permits mixed-protocols testing relaying on REST API for those which are not http2 traffic servers.

Additional context
Imagine that your system under test is composed by the main process to test and then some server components mocking the data base or whatever facility provided to simulate the SUT context. Now imagine that those mocks have an smart REST API which could be used to inspect the traffic reveiced. From hermes you could also use that REST API as part of traffic validation delegating on those external agents. In this way you could make complex test flows including whatever kind of agent (servers, even clients, for different protocols, not only http2) just having a REST API for them which is based in http2 (or even http/1 with a nginx reverse proxy in fornt of them).
This feature could be backward compatible with a default definition (not a one-item-list but just accepting current schema definition or a list with 2 (or even 1) or more items).

Add istio podAnnotations to hermes helmchart

Right now, sidecar injection is done with a flag in the values.yaml file, and expanded in the deployment template.
Instead of that, podAnnotations shall be used as in hermes-example

Add License

I want to have a note in the Readme for the 3pp licenses. It might not be necessary, but just in case. (Gtest and boost).

Fix clang-format issues

The code was supposed to be already formatted. Running clang format, formats the code, so something is going on there.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.