Git Product home page Git Product logo

maestro's Introduction

Multithread And Epoll Server To Revolve Online (Maestro)

This project aims to create a tiny but functional application server by 
leveraging multithread and epoll features of linux OS. 
 
All the source code is written in C. 
 
The project is a WIP (Work In Progress) project. It is still in its infant 
stage. More features will be added in the future.

Features

-- Multithread pool
-- Epoll (so, linux specific)
-- HTTP/1.1 GET method (static file)
-- HTTP/1.1 keep-alive (long connection, disconnected after timeouts)
-- deflate compression
-- download resumption

Cloning

git clone https://github.com/grassroot72/Maestro.git

Building

$ make
...
$ ./maestro

Testing

Running Apache Bench, I used the following command,
$ ab -k -n 5000 -c 100 http://localhost:9000/bench.html 
 
You may also want to put the compression option on,
$ ab -k -n 5000 -c 100 -H "Accept-Encoding: deflate" http://localhost:9000/bench.html 
 
Please replace localhost to your hostname if you would like to test on 
other computers.
 
The following is the test result on my very low-end laptop,
** CPU: Intel Celeron N2930 (4 cores) at ~2.16 GHz (2M Cache) **
** MEM: 4G **
** NET: laptop built-in wireless **

Server Software:        Maestro/1.0
Server Hostname:        warrior
Server Port:            9000

Document Path:          /bench.html
Document Length:        142 bytes

Concurrency Level:      100
Time taken for tests:   10.981 seconds
Complete requests:      5000
Failed requests:        0
Keep-Alive requests:    5000
Total transferred:      1790000 bytes
HTML transferred:       710000 bytes
Requests per second:    455.31 [#/sec] (mean)
Time per request:       219.629 [ms] (mean)
Time per request:       2.196 [ms] (mean, across all concurrent requests)
Transfer rate:          159.18 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    5 125.4      0    7145
Processing:    35  204 138.3    147     880
Waiting:        8   69  23.4     66     544
Total:         36  209 186.3    147    7263

Percentage of the requests served within a certain time (ms)
  50%    147
  66%    169
  75%    193
  80%    230
  90%    462
  95%    527
  98%    587
  99%    650
 100%   7263 (longest request)

If you test it on most recently manufactured computers, you will get much 
better benchmark results.

To test download resumption, uncomment #define DEBUG and build again, then,
$ ./maestro 
resumption still needs a lot of optimization, but it works with firefox.

Note

I am not the author of the pdf file under the download folder, I only 
use it for download resumption test.

Todo

I want to develop an HTTP/1.1 compatible webserver as well as an application 
server which will skip traditional CGI function and directly provide dynamic 
services (POST/PUT/DELETE...) through built-in functions.

todo list:
HTTP/1.1 POST/PUT/DELETE
build-in cache to provide better GET performance
industry level logging
HTTPS

maestro's People

Contributors

grassroot72 avatar

Watchers

James Cloos 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.