Giter Site home page Giter Site logo

h0x91b / haywire Goto Github PK

View Code? Open in Web Editor NEW

This project forked from haywire/haywire

0.0 2.0 0.0 2.66 MB

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.

License: Apache License 2.0

CMake 3.83% Shell 1.55% Lua 0.15% Python 2.92% C 91.54%

haywire's Introduction

Build Status Haywire

Haywire is an asynchronous HTTP server framework written in C. The goal of Haywire is to learn how to create a server with a minimal feature set that can handle a high rate of requests and connections with as low of latency and resource usage as possible.

Haywire uses the event loop based libuv platform layer that node.js is built on top of (also written in C). libuv abstracts IOCP on Windows and epoll/kqueue/event ports/etc. on Unix systems to provide efficient asynchronous I/O on all supported platforms.

Haywire isn't very useful yet but I wanted to open source it from the very beginning. I started experimenting with a HTTP server for Dazzle queries and I decided I would split it into its own project.

Features

  • Cross platform (Windows, Linux, OSX)
  • HTTP keep-alive
  • HTTP pipelining
  • Non-blocking I/O

Plans or Ideas

  • HTTP handler routing
  • SPDY support
  • Export an API that is easily consumable by other languages like on the JVM (Java, etc) and the CLR (C#, etc)

Contributions

Feel free to join in if you feel like helping progress Haywire. I'm open to new ideas and would love to work with some people instead of by myself!

Building Haywire

To compile Haywire you need git and python installed and in your path.

Haywire uses gyp which supports generating make type builds or Visual Studio and Xcode projects. The Visual Studio and Xcode projects aren't fully complete so they may not function just yet but they will real soon, hang in there.

git clone https://github.com/kellabyte/Haywire.git

Compiling on Linux and Mac OSX

./build.sh

Compiling on Windows

Open the Developer Command Prompt for Visual Studio

build.bat

Current benchmark measurements

Setup 1

  • 1 Azure Large VM (Ubuntu) 4 Haywire instances of Haywire (1 per CPU core) load balanced by HAProxy
  • 1 Azure Large VM (Ubuntu) client running Wrk HTTP benchmarking tool.

Results

  • 601,077 requests/second.
  • Average over 800 mbps (Azure network delivers 800 mbps so we are saturating capacity).
  • Average less than 40% CPU usage.

Setup 1 results

Setup 2

  • 1 Azure Large VM (Ubuntu) 1 Haywire instance with 4 thread (1 per core) event loop fan out.
  • 1 Azure Large VM (Ubuntu) client running Wrk HTTP benchmarking tool.

Results

  • 574,462 requests/second.
  • Average 800 mbps (Azure network delivers 800 mbps so we are saturating capacity).
  • Average less than 60% CPU usage.
Latency distribution
    wrk -d10 -t24 -c24 --pipeline 512 --latency http://server:8000
    Running 10s test @ http://server:8000
      24 threads and 24 connections
      Thread Stats   Avg      Stdev     Max   +/- Stdev
        Latency    23.94ms   15.11ms 134.66ms   84.97%
        Req/Sec    25.57k     9.61k   58.60k    65.55%
      Latency Distribution
         50%   19.34ms
         75%   28.39ms
         90%   41.16ms
         99%   79.15ms
      5743304 requests in 10.00s, 0.87GB read
    Requests/sec: 574,462.58
    Transfer/sec:     89.30MB

Setup 2 results

haywire's People

Contributors

cww avatar georgehahn avatar hyc avatar jbcrail avatar jbogard avatar kellabyte avatar michaelhood avatar nschonni avatar pphaneuf avatar

Watchers

 avatar  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.