38 lines
1.2 KiB
Markdown
38 lines
1.2 KiB
Markdown
**Reqser**
|
|
==========================
|
|
|
|
This is a simple web server built with the Hyper framework. I wrote this as a demonstration of fast request handling in rust.
|
|
|
|
**Features**
|
|
------------
|
|
|
|
* Request counting with atomic counters
|
|
* Metric reporting through two API endpoints: `/data/requests` and `/data/cpu`
|
|
|
|
**Techstack**
|
|
-----------------
|
|
|
|
* **Lock-free request counting**: Using atomic counters to increment the request count. Lower CPU usage
|
|
* **Sharded request counting**: Dividing the request count among multiple shards.
|
|
* **Time series data storage**: Using a `VecDeque` to store time series data.
|
|
* **Tokio async framework**: Using Tokio to handle asynchronous requests and tasks.
|
|
* **Hyper framework**: Using Hyper to build the web server and handle HTTP requests.
|
|
|
|
**Build and Run**
|
|
----------------
|
|
|
|
To build and run the server, use the following commands:
|
|
|
|
```bash
|
|
cargo build
|
|
cargo run
|
|
```
|
|
|
|
This will start the server and make it available at `http://0.0.0.0:80`. The metrics endpoints can be accessed at:
|
|
|
|
* `http://0.0.0.0:80/data/requests`
|
|
* `http://0.0.0.0:80/data/cpu`
|
|
|
|
**Note**
|
|
----------------
|
|
This "project" has no purpose. I made it to demonstrate that most webapps are ass inefficient. lmao |