How thuong31415/vortex works
Project Overview & Components
• Project Type & Purpose: Vortex is a high-performance web server aimed at efficiently handling HTTP requests with minimal resources. It implements a multi-threaded architecture to support concurrency and uses epoll for scalable event handling.
• Main Components:
• HTTP module: Includes HTTPRequest, HTTPResponse, and HttpHandler that parse and manage HTTP transactions.
• Network module: Contains components like Socket and Epoll, which implement the low-level I/O multiplexer and network socket management.
• Server module: Embodies the core server logic (accepting connections, routing requests, etc.).
• Thread Pool: Provides multi-threading support to handle multiple client requests concurrently.
• Client module: Although not a core server component, this directory indicates a basic test or demonstration client for sending requests and possibly validating the server functionality.
• Main Application (main.cpp): Likely responsible for bootstrapping the server, initializing modules, and starting the event loop.
Architectural Patterns & Design Principles
• Multi-threaded / Thread Pool Pattern: Emphasize how the thread pool serves concurrent tasks.
• Reactor Pattern: As implemented through the epoll-based event loop that listens for I/O events on multiple sockets.
• Separation of Concerns: Break down system responsibilities between networking (connection management), HTTP processing (protocol interpretation), and server orchestration.
• Lightweight Architecture: Note that each module is designed with minimal overhead for performance.
• Main → Server
• Server → Epoll (Network)
• Epoll → Thread Pool (upon detecting an event)
• Thread Pool → HTTP Handler (for processing)
• HTTP Handler → Socket (for sending response back to client)
• Another shade for concurrency (Thread Pool).