package httpaf

  1. Overview
  2. Docs
A high-performance, memory-efficient, and scalable web server for OCaml

Install

Dune Dependency

Authors

Maintainers

Sources

0.5.0.tar.gz
md5=74c6e897658e820006106f45f736381f

Description

http/af implements the HTTP 1.1 specification with respect to parsing, serialization, and connection pipelining as a state machine that is agnostic to the underlying IO mechanism, and is therefore portable across many platform. It uses the Angstrom and Faraday libraries to implement the parsing and serialization layers of the HTTP standard, hence the name.

Published: 11 Dec 2018

README

http/af

http/af is a high-performance, memory-efficient, and scalable web server for OCaml. It implements the HTTP 1.1 specification with respect to parsing, serialization, and connection pipelining as a state machine that is agnostic to the underlying IO mechanism, and is therefore portable across many platform. It uses the Angstrom and Faraday libraries to implement the parsing and serialization layers of the HTTP standard, hence the name.

Installation

Install the library and its dependencies via OPAM:

opam install httpaf

Performance

The reason for http/af's existence is mirage/ocaml-cohttp#328, which highlights the poor scalability of cohttp. This is due to a number of factors, including poor scheduling, excessive allocation, and starvation of the server's accept loop. Here is a comparison chart of the data from that issue, along with data from an async-based http/af server. This server was run on a VM with 3 virtual cores, the host being circa 2015 MacBook Pro:

The http/af latency histogram, relative to the cohttp histograms, is pretty much flat along the x-axis. Here are some additional statistics from that run (with latencies in milliseconds):

#[Mean    =       27.719, StdDeviation   =       31.570]
#[Max     =      263.424, Total count    =      1312140]
#[Buckets =           27, SubBuckets     =         2048]
----------------------------------------------------------
  1709909 requests in 1.00m, 3.33GB read

Usage

WIP

Development

To install development dependencies, pin the package from the root of the repository:

opam pin add -n httpaf .
opam install --deps-only httpaf

After this, you may install a development version of the library using the install command as usual.

Tests can be run via jbuilder:

jbuilder runtest

License

BSD3, see LICENSE files for its text.

Dependencies (5)

  1. result
  2. faraday >= "0.5.0"
  3. angstrom >= "0.9.0"
  4. jbuilder >= "1.0+beta10"
  5. ocaml >= "4.03.0"

Dev Dependencies (1)

  1. alcotest with-test

Conflicts

None