Code Monkey home page Code Monkey logo

rust_webserver's Introduction

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

rust_webserver's People

Contributors

desjajja avatar codecrafters-bot avatar

Stargazers

ChenKugai avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.