Skip to content

Desjajja/rust_webserver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A Web Server in Rust

Implementations

  1. multithread (threadpool): on branch master
  2. async (tokio): on branch tokio

Features

  1. High concurrency (as shown in section Performance Summary)
  2. multiply methods supported(POST, GET), along with various services(echo, file IO, etc.)
  3. modular architecture (as abstracted into request and response mods)

Serving Endpoionts

  • GET

    • /: return 200 with empty body

      root

    • /echo: echo whatever comes after it

      echo

    • /user-agent: return 200 with user-agent

    • /files: fetch files from the assigned directory on server side. (set when running with cargo run -- --directory <root-dir>), invalid path get a 404.

      get_file

  • POST

    • /files: create a file using body as its content, get 201 when succeeded, 500 when failed

post_file

Performance Summary

device: Laptop

Num of thread: 10

method: GET

serving endpoint: http://localhost:4321/

concurrency: 20,000

thread_pool-20000

Acknowledgement

CodeCrafters.io: this project starts from one of their their chanllenging and scrupulous challenges.

Rust Programming Language: most intelligent compiler ever!

oha: its well designed tui and function made testing less upset

About

A web server written in rust

Resources

Stars

Watchers

Forks