Skip to content

A simple http server in c++ backed by libuv and http-parser.

Notifications You must be signed in to change notification settings

jwerle/libuv-http

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SYNOPSIS

A simple http server backed by libuv and http-parser.

EXAMPLE

#include "http.h"

int main() {

  Server hs([](auto &req, auto &res) {
    
    res.setStatus(200);
    res.setHeader("Content-Type", "text/plain");
    res.setHeader("Connection", "keep-alive");
    res << req.method << " " << req.url << endl;
 
  });
  
  hs.listen("0.0.0.0", 8000);
}

PERFORMANCE

Just for fun. Without any real statistical significance, here are some quick averages from apache ab, run on an old macbook air. Also neat is that libuv-http uses about 400KB of memory compared to Node.js' 10-15MB.

libuv-http

Requests per second:    16333.46 [#/sec] (mean)

node.js

Requests per second:    3366.41 [#/sec] (mean)

DEVELOPMENT

REQUIREMENTS

  • clang 3.5
  • gyp
  • leveldb
  • libuv
  • http-parser

DEBUGGING

VALGRIND

valgrind --leak-check=yes --track-origins=yes --dsymutil=yes ./server

BUILD

make

About

A simple http server in c++ backed by libuv and http-parser.

Resources

Stars

Watchers

Forks

Packages

No packages published