Skip to content

juanmait/tokio-hyper-single-thread

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Example Tokio Single Thread

The goal of this project is to experiment with tokio & hyper creating an asynchronous http server that runs in a single tread.

Run in Release Mode

Run the server in --release mode:

cargo run --release

Development

Run the server in dev mode with tracing in debug level:

RUST_LOG=example_tokio_single_thread=debug cargo run

Watch mode

Install cargo-watch:

cargo install cargo-watch

Watch the server in dev mode with tracing in debug level:

RUST_LOG=example_tokio_single_thread=debug cargo watch -w src -x run

Benchmarks

If wrk is available you can test the performance of the server like this:

NOTE: First run the rust server in --release mode for performance tests

# threads: 1
# open connections: 1
# run for 10s
wrk -t1 -c1 -d10s http://127.0.0.1:3000

There is also a plain nodejs http server available in ./node/server.js. You can use it to compare the performance between the two.

# start the server
node node/server.js --port 4032

# run the benchmark
wrk -t1 -c1 -d10s http://127.0.0.1:4032

Next Goals

  • integrate more benchmarking tools
  • support https & http2
  • generate rustdoc documentation

Ecosystem

Crate Description
bytes Provides abstractions for working with bytes.
env_logger A logger configured via env vars, to use with the logging facade exposed by log
hyper (see examples)
hyper-util Utilities for hyper
http-body Asynchronous HTTP request or response body
http-body-util Utilities for http-body
log A lightweight logging facade.
pretty_env_logger Writes to standard error with nice colored output for log levels.
tokio-macros -
tokio -
url implementation of the URL Standard for the Rust programming language.

About

The goal of this project is to experiment with Tokio & Hyper creating an asynchronous http server that runs in a single tread

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages