http2

This is the development repository of http2 for the ewe web server.

Initially, all the work was done in the http2 branch of ewe’s repository. But I came to the conclusion that multitasking the development of http2 and integration into the existing codebase of ewe is not the best idea and only slows the process.

Once I feel confident about what I have here, I will move into rewriting ewe (yes, there is a bunch of work to do), as well as integrating the http2 implementation.

As of the moment of writing the README file, the implementation passes all the h2spec test cases. Also, by the setup I have in the benchmark/ folder, my implementation is faster than bandit at everything that my current solution has (there are also attempts at comparing the solution with Cowboy, but I am very confused whether I did the right setup, since the results don’t seem right to me)

You can see the benchmarking results in results.txt. Any help and feedback are welcome!

Verifying specifications

Start the server with gleam run and then:

h2spec -h 127.0.0.1 -p 8080 -S -P /hello 

Profiling

The load command I use for the work:

h2load -c 100 -m 10 -t 4 -p h2c -D 15 \
  -H "cookie: session=abc123def456" \
  -H "cookie: theme=dark" \
  -H "cookie: locale=en-US" \
  -H "x-request-id: 9f86d081-b1bb-4c2e-8f21-9c7b1f2a0e3e" \
  -H "x-client-version: 4.2.1" \
  -H "accept-language: en-US,en;q=0.9" \
  -H "x-forwarded-for: 203.0.113.42" \
  -d ./benchmark/bodies/body-10kb.bin \
  http://127.0.0.1:8080/echo

Start the server with:

ERL_FLAGS="-name http2srv@127.0.0.1 -setcookie h2prof" gleam run

Then attach the session and run profiling:

erl -name prof@127.0.0.1 -setcookie h2prof -remsh http2srv@127.0.0.1

(http2srv@127.0.0.1)1> eprof:start().
{ok,<0.370259.0>}
(http2srv@127.0.0.1)2> eprof:start_profiling(erlang:processes()).
profiling
# Run the load command after that and wait for the work to finish
(http2srv@127.0.0.1)3> eprof:stop_profiling().
profiling_stopped
(http2srv@127.0.0.1)4> eprof:log("eprof.txt").
ok
(http2srv@127.0.0.1)5> eprof:analyze(total).
Search Document