Giter Site home page Giter Site logo

lotos's Introduction

Lotos WebServer

Build Status

Lotos is a tiny but high-performance HTTP WebServer following the Reactor model, using non-blocking IO and IO multiplexing(epoll ET) to handle concurrency. Lotos is written in pure c and well tested. Several HTTP headers (Connection, Content-Length, etc.) is supported and more will be added in the future.

-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
C                               19            367            275           2428
C/C++ Header                    12            120            131            514
make                             2             17              0             42
CMake                            1              7              0             18
-------------------------------------------------------------------------------
SUM:                            34            511            406           3002
-------------------------------------------------------------------------------

Documents

0x01 0x02 0x03 0x04 0x05 0x06
项目目的 并发模型 设计实现 测试调试 性能测试 调试记录

Environment

  • gcc >= 5.4 or clang >= 3.5 (gcc4.9 is not supported)
  • Linux only, kernel version >= 3.9

Usage

Build

$ git clone https://github.com/chendotjs/lotos.git
$ cd lotos/src/
$ make && make test

Run

Usage: lotos -r html_root_dir [-p port] [-t timeout] [-w worker_num] [-d (debug mode)]

$ ./lotos -r ../www -t 60 -w 4 -p 8888

then you can visit http://localhost:8888/.

Feature

  • EPOLL Edge Trigger mode, more efficient.
  • Nonblocking IO.
  • Multiprocessing, port reuse.
  • TCP connections managed by min-heap data structure.
  • HTTP persistent connection support. Close TCP connection when connection expires.
  • Parse HTTP requests using FSM.
  • Handle errors and exceptions.
  • Memory pool is optional.

Test

Unit tests are based on minctest. It is simple, lightweight, and flexible.

Moreover, I contributed some codes to it.

Benchmark

Please refer to BENCHMARK.md.

Reference

nginx

node.js http parser

Tkeed

lotos's People

Contributors

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