GithubHelp home page GithubHelp logo

nixigaj / wut-server Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 20 KB

A simple HTTP(/2) server written in Rust, made for one thing, and one thing only: securely echoing your public IP-address as fast as possible.

Home Page: https://ip.erix.dev:11313

License: MIT License

Rust 100.00%
blazingly-fast http2 hyper ip ip-address ipv4 ipv6 public-ip rust server wut

wut-server's Introduction

wut icon

wut server

This is a simple HTTP(/2) server written in Rust, made for one thing, and one thing only: securely echoing your public IP-address as fast as possible. It is made for the wut cli tool, and I use it for ip.erix.dev:11313.

Non-scientific comparison with Nginx

Server

CPU RAM Uplink
Single core AMD EPYC 7302P 1 GB ECC 1 Gbit/s

Client

CPU RAM Uplink
AMD Ryzen 5600 32 GB ECC 250 Mbit/s

The tool used for the benchmark is wrk. The bottleneck in this test will be the server CPU.

Nginx

Nginx has all optimization options enabled, headers stripped with the ngx_headers_more module, and is compiled with static OpenSSL and LTO.

Config

load_module modules/ngx_http_headers_more_filter_module.so;

pid /var/run/nginx.pid;

worker_processes 1;

events {
	worker_connections 1024;
}

http {
	sendfile on;
	server_tokens off;
	more_clear_headers "Server";
	more_clear_headers "X-Powered-By";
	more_clear_headers "content-type";

	http2 on;
	ssl_protocols TLSv1.3;
	ssl_early_data on;
	ssl_certificate <cert path>;
	ssl_certificate_key <key path>;

	server {
		return 200 "$remote_addr";
		listen [<IPv6>]:443 ssl;
		listen <IPv4>:443 ssl;
	}
}

Benchmark

Running 10s test @ https://ip.erix.dev
  6 threads and 1000 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    28.07ms   10.63ms 520.46ms   86.30%
    Req/Sec     4.36k     0.96k    6.54k    72.18%
  257322 requests in 10.03s, 27.98MB read
  Socket errors: connect 95, read 17, write 0, timeout 0
Requests/sec:  25650.31
Transfer/sec:      2.79MB

wut server

Benchmark

Running 10s test @ https://ip.erix.dev:11313
  6 threads and 1000 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    45.00ms   50.48ms 279.57ms   78.59%
    Req/Sec     6.41k     1.23k    8.65k    83.47%
  382057 requests in 10.02s, 32.79MB read
Requests/sec:  38110.60
Transfer/sec:      3.27MB

That is about 49% more requests per second. Additionally, some socket errors were encountered with Nginx.

Usage

Usage: wut-server [OPTIONS] --cert-path <CERT_PATH> --key-path <KEY_PATH>

Options:
  -b, --bind <BIND>                  Address to bind to, with optional port (can be provided multiple times) [default: 127.0.0.1:11313 [::1]:11313]
  -c, --cert-path <CERT_PATH>        Certificate file path
  -k, --key-path <KEY_PATH>          Key file path
  -i, --log-interval <LOG_INTERVAL>  Log interval in seconds [default: 60]
  -2, --http2-only                   Use HTTP/2 only
  -h, --help                         Print help
  -V, --version                      Print version

Planned features

  • Automatic hot reload of certificates when files on disk change.

License

All files in this repository are licensed under the MIT License.

The icon is a reference to the Confused Nick Young / Swaggy P meme.

wut-server's People

Contributors

nixigaj 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.