web-server
web-server copied to clipboard
A Web Server designed with Reactor I/O Model
speed-x
A HTTP server designed with Reactor I/O Model
Design Pattern
One Loop Per Thread
- Each thread has an event loop
epoll
Multiple Reactor
- Main event loop is responsible for
listenfd
andaccept
- Sub event loop is responsible for
handleEvent
- Use the roundbin scheduling policy
Flow Diagram
Establish Connection
The main reactor(event loop) distributes the connection to the sub-reactor, when a new connection is made
Close Connection
Requirements
- Linux
- GCC
- Boost
Build
sudo apt-get install libboost-all-dev
cd build
cmake ..
make
Usage
./speedX
http://127.0.0.1:8000
References
- Linux多线程服务端编程