Update README
This commit is contained in:
parent
80f7caad84
commit
a34f14f6f5
1 changed files with 56 additions and 1 deletions
57
README.md
57
README.md
|
@ -1,2 +1,57 @@
|
||||||
# playground-rs
|
# Playground RS
|
||||||
|
|
||||||
|
A simple multi-threaded web server implementation in Rust. This project demonstrates the implementation of a basic HTTP server with a thread pool for handling concurrent connections.
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- Multi-threaded web server implementation
|
||||||
|
- Custom thread pool for handling concurrent connections
|
||||||
|
- Basic HTTP response handling
|
||||||
|
- Graceful shutdown mechanism
|
||||||
|
|
||||||
|
## Project Structure
|
||||||
|
|
||||||
|
- `src/main.rs` - Entry point of the application
|
||||||
|
- `src/server.rs` - Web server implementation
|
||||||
|
- `src/thread_pool.rs` - Custom thread pool implementation
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
|
||||||
|
- Rust 2024 edition
|
||||||
|
- Cargo (Rust's package manager)
|
||||||
|
|
||||||
|
## Running the Project
|
||||||
|
|
||||||
|
1. Clone the repository:
|
||||||
|
```bash
|
||||||
|
git clone <repository-url>
|
||||||
|
cd playground-rs
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Build and run the project:
|
||||||
|
```bash
|
||||||
|
cargo run
|
||||||
|
```
|
||||||
|
|
||||||
|
The server will start on `127.0.0.1:7878`. You can test it by opening a web browser and navigating to `http://127.0.0.1:7878` or using curl:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl http://127.0.0.1:7878
|
||||||
|
```
|
||||||
|
|
||||||
|
## Implementation Details
|
||||||
|
|
||||||
|
### Thread Pool
|
||||||
|
|
||||||
|
The project implements a custom thread pool that:
|
||||||
|
- Creates a fixed number of worker threads
|
||||||
|
- Uses message passing for job distribution
|
||||||
|
- Handles graceful shutdown
|
||||||
|
- Manages thread lifecycle
|
||||||
|
|
||||||
|
### Web Server
|
||||||
|
|
||||||
|
The web server:
|
||||||
|
- Listens on localhost port 7878
|
||||||
|
- Uses the thread pool to handle incoming connections
|
||||||
|
- Responds with a simple "Hello, world!" message
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue