This repository contains an implementation of a multithreaded web server in Rust.
The server demonstrates Rust's concurrency capabilities by handling multiple connections simultaneously using a thread pool architecture. This implementation showcases key Rust concepts such as:
- Thread management
- Thread pools
- MPSC (Multiple Producer, Single Consumer) channels
- Safe concurrency patterns
- Error handling
- Configurable thread pool for handling concurrent connections
- Graceful request handling and response generation
- Basic HTTP request parsing
- Static file serving capabilities
- Clean shutdown mechanism
The server uses a thread pool to manage a predefined number of worker threads. When a new connection arrives, it's passed to an available worker thread for processing rather than spawning a new thread for each connection, which provides better resource utilization and performance.
To run the server:
cargo run
The server will start listening on 127.0.0.1:7878
by default.
You can test the server by opening a web browser and navigating to:
http://127.0.0.1:7878