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
-------------------------------------------------------------------------------
0x01 | 0x02 | 0x03 | 0x04 | 0x05 | 0x06 |
---|---|---|---|---|---|
项目目的 | 并发模型 | 设计实现 | 测试调试 | 性能测试 | 调试记录 |
- gcc >= 5.4 or clang >= 3.5 (gcc4.9 is not supported)
- Linux only, kernel version >= 3.9
$ git clone https://github.com/chendotjs/lotos.git
$ cd lotos/src/
$ make && make test
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/.
- 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.
Unit tests are based on minctest. It is simple, lightweight, and flexible.
Moreover, I contributed some codes to it.
Please refer to BENCHMARK.md.