Go to file
2024-11-11 23:59:31 +01:00
src Add src/main.rs 2024-11-11 23:59:31 +01:00
README.md Add README.md 2024-11-11 23:59:12 +01:00

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:

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