Code Monkey home page Code Monkey logo

libuv-httpserver's Introduction

libuv-httpserver

  • Author: Ryan
  • Last modified: 2014.12.23

A simple web server based on libuv and http-parser. (only echo Hello, World!\r\n)

Dependencies

It takes lastest stable versions:

  • Libuv, Release v1.0.2 (released on 2014.12.10)
  • http-parser, Release v2.3 (released on 2014.5.13)

How to

Make sure you are on OS X, Xcode installed, gyp installed.

git clone [email protected]:Ryannnnnnn/libuv-httpserver.git && cd libuv-httpserver
git submodule update --init

make
./httpserver

Then, curl 127.0.0.1:8888 to test it.

Resources

  • using libuv and http-parser to build a webserver
    • Tutorial by Ryan Dahl (2011), APIs changed, but basic routine stills
  • learnuv - Learn uv for fun and profit, a self guided workshop to the library that powers Node.js.
    • It's of great fun! I passed the first 7 exercises to comprehend libuv APIs
  • uv.h
    • Quick Reference for libuv
  • Haywire - Haywire is an asynchronous HTTP server framework written in C that's built using the event loop based libuv platform layer that node.js is built on top of.
    • Oops!

Benchmark

ab on My Macbook Air (8G, 1.3 GHz): ab -n 10000 -c 100 http://127.0.0.1:8888/

Document Path:          /
Document Length:        16 bytes

Concurrency Level:      100
Time taken for tests:   0.855 seconds
Complete requests:      10000
Failed requests:        0
Total transferred:      810000 bytes
HTML transferred:       160000 bytes
Requests per second:    11696.29 [#/sec] (mean)
Time per request:       8.550 [ms] (mean)
Time per request:       0.085 [ms] (mean, across all concurrent requests)
Transfer rate:          925.19 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        2    4   0.8      4      15
Processing:     2    4   1.2      4      15
Waiting:        1    4   1.2      4      15
Total:          6    8   1.6      8      20

Percentage of the requests served within a certain time (ms)
  50%      8
  66%      9
  75%      9
  80%     10
  90%     10
  95%     11
  98%     12
  99%     19
 100%     20 (longest request)

libuv-httpserver's People

Contributors

parachvte avatar

Watchers

 avatar

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.