Janus WebServer is a high-performance web server built with modern C++ and designed with Reactor pattern and event-driven architecture. The project aims to provide an efficient, stable, and extensible network server framework.
The project is currently under development and implementing features step by step according to a detailed roadmap.
- 🚀 epoll-based IO multiplexing
- ⚡ Event-driven Reactor pattern
- 🧵 Multi-threading support (One Loop Per Thread)
- 📦 RAII resource management mechanism
- 🌐 HTTP protocol support
- 🔧 High-performance buffer design
- 🛠 Modern C++ features
┌─────────────────┐
│ HttpServer │ Application Layer: HTTP protocol parsing and handling
└─────────────────┘
┌─────────────────┐
│ TcpServer │ Transport Layer: TCP connection management
└─────────────────┘
┌─────────────────┐
│ EventLoopPool │ Threading Model: Thread pool management
└─────────────────┘
┌─────────────────┐
│ EventLoop │ Core Layer: Event loop
└─────────────────┘
┌─────────────────┐
│ Epoll │ System Layer: IO multiplexing
└─────────────────┘
┌─────────────────┐
│ Socket/Channel │ Foundation Layer: Socket encapsulation
└─────────────────┘
Implement basic socket encapsulation and build the foundation of RAII resource management model.
Build the core components of event-driven architecture, including Channel, Epoll and EventLoop.
Implement object-oriented connection management and introduce Buffer to solve packet sticking problems.
Add HTTP protocol parsing capabilities to build a complete HTTP server.
Implement multi-threading model to improve concurrent processing capability of the server.
Performance optimization and implementation of advanced features.
See detailed roadmap in ROADMAP.md
- C++20 or higher
- Linux system (epoll support)
- CMake 3.10+
- Python 3.6+ (for test scripts)
# Clone the project
git clone ssh://git@ssh.github.com:443/yedou37/WebServer.git
cd janus-webserver
# Create build directory
mkdir build && cd build
# Compile the project
cmake ..
make./janus-webserverBy default, the server listens on port 8080.
# Create virtual environment
python3 -m venv venv
# Activate virtual environment
source venv/bin/activate
# Install test dependencies
pip install -r requirements.txt
# Deactivate virtual environment
deactivateEnsure the server is running, then execute tests:
# Activate virtual environment
source venv/bin/activate
# Run integration tests
python -m pytest tests/integration_test/ -v
# Run specific test
python tests/test_concurrency.py
# Deactivate virtual environment
deactivatesrc/
├── base/ # Base components
│ ├── Macros.hh # Common macro definitions
│ └── Buffer.cpp # Data buffer
├── net/ # Network modules
│ ├── Socket.cpp # Socket encapsulation
│ ├── InetAddress.cpp # IP address encapsulation
│ ├── Channel.cpp # Event channel
│ ├── Epoll.cpp # epoll operation encapsulation
│ ├── EventLoop.cpp # Event loop
│ ├── EventLoopThread.cpp # Event loop thread
│ ├── EventLoopThreadPool.cpp # Thread pool
│ ├── TcpConnection.cpp # TCP connection
│ └── TcpServer.cpp # TCP server
├── http/ # HTTP module (planned)
└── main.cpp # Main program entry
Issues and Pull Requests are welcome to help improve the project. Before contributing code, please ensure:
- Follow the existing code style of the project
- Add appropriate test cases
- Update relevant documentation
This project is licensed under the MIT License - see the LICENSE file for details.
- Inspired by the muduo network library
- Referenced design ideas from CS144 Computer Networking course
Janus WebServer - Building high-performance web servers with modern C++