Skip to content

Commit

Permalink
v0.2.0 Release
Browse files Browse the repository at this point in the history
  • Loading branch information
mufeedvh committed Jun 13, 2022
1 parent ef0a20b commit 7c30dd6
Show file tree
Hide file tree
Showing 42 changed files with 1,861 additions and 723 deletions.
6 changes: 0 additions & 6 deletions .cargo/config

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/CICD.yml → .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ name: CICD

env:
PROJECT_NAME: binserve
PROJECT_DESC: "A blazingly fast static web server in a single binary you can set up with zero code. ⚡🦀"
PROJECT_DESC: "A fast static web server with TLS (HTTPS), Routing, Hot Reloading, Caching, Templating, and Security in a single-binary you can set up with zero code."
PROJECT_AUTH: "mufeedvh"
RUST_MIN_SRV: "1.42.0" ## minimum supported rust version (aka, MinSRV or MSRV)
RUST_COV_SRV: "2020-08-01" ## (~v1.47.0) supported rust version for code coverage; (date required/used by 'coverage')
Expand Down Expand Up @@ -445,4 +445,4 @@ jobs:
## flags: IntegrationTests, UnitTests, ${{ steps.vars.outputs.CODECOV_FLAGS }}
flags: ${{ steps.vars.outputs.CODECOV_FLAGS }}
name: codecov-umbrella
fail_ci_if_error: false
fail_ci_if_error: false
22 changes: 0 additions & 22 deletions .github/workflows/linux-rust.yml

This file was deleted.

22 changes: 0 additions & 22 deletions .github/workflows/macos-rust.yml

This file was deleted.

22 changes: 0 additions & 22 deletions .github/workflows/windows-rust.yml

This file was deleted.

21 changes: 15 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Generated by Cargo
# will have compiled files and executables
/target/
debug/
target/

# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Expand All @@ -9,11 +10,19 @@ Cargo.lock
# These are backup files generated by rustfmt
**/*.rs.bk

# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb
# Generated by Cargo
# will have compiled files and executables
debug/
target/

# Added by cargo
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Cargo.lock

/target
# These are backup files generated by rustfmt
**/*.rs.bk

/rendered_templates
binserve.json
release.py
# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb
113 changes: 113 additions & 0 deletions BENCHMARKS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
# Benchmarks

Benchmarks are performed with [wrk](https://github.com/wg/wrk). All of the servers tested serve the same static page, benchmark is ran 3 times and the best one of them is chosen.

> **FUN FACT:** Microbenchmarks like this are not a good measure for "dynamic web apps" which most websites are, in that context, your bottleneck is going to be disk I/O and database queries and a metric like requests/sec doesn't measure anything meaningful. Here, there is a very specific goal -- to serve static files and the bottlenecks can be minimized and there are no external constraints hence why this benchmark exists. :)
## Tested On:

> Linux Kernel Version: 5.17.5-76051705-generic
>
> CPU Description: Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
>
> CPU ID: GenuineIntel,6,142,10
>
> CPU Architecture: x86_64
>
> CPUs Available: 8
>
> Total Memory: 25.1 GB
## Results

<div align="center">
<table>
<tr><td><img src="https://raw.githubusercontent.com/mufeedvh/binserve/main/assets/benchmarks.jpeg" width="500"></td></tr>
</table>
</div>

## Binserve

```
$ wrk -c 500 -t 12 -d 5s http://127.0.0.1:1337/
Running 5s test @ http://127.0.0.1:1337/
12 threads and 500 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 2.41ms 372.48us 32.88ms 92.11%
Req/Sec 17.07k 2.14k 38.17k 96.87%
1030467 requests in 5.10s, 239.79MB read
Requests/sec: 202074.22
Transfer/sec: 47.02MB
```

## NGINX Tuned:

**Source:** https://github.com/denji/nginx-tuning

```
$ wrk -c 500 -t 12 -d 5s http://127.0.0.1:8081/
Running 5s test @ http://127.0.0.1:8081/
12 threads and 500 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 2.40ms 1.87ms 34.64ms 71.69%
Req/Sec 17.07k 5.49k 38.06k 64.67%
1023120 requests in 5.08s, 250.76MB read
Requests/sec: 201407.17
Transfer/sec: 49.36MB
```

## NGINX Default:

```
$ wrk -c 500 -t 12 -d 5s http://127.0.0.1:8081/
Running 5s test @ http://127.0.0.1:8081/
12 threads and 500 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 4.24ms 2.55ms 34.47ms 78.72%
Req/Sec 9.85k 1.98k 34.39k 92.87%
593245 requests in 5.10s, 145.37MB read
Requests/sec: 116415.16
Transfer/sec: 28.53MB
```

## Lighttpd:

```
$ wrk -c 500 -t 12 -d 5 http://127.0.0.1:7822/
Running 5s test @ http://127.0.0.1:7822/
12 threads and 500 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 49.76ms 102.76ms 475.80ms 86.45%
Req/Sec 6.45k 3.15k 42.89k 77.46%
384892 requests in 5.07s, 83.39MB read
Requests/sec: 75915.69
Transfer/sec: 16.45MB
```

## Caddy:

```
$ wrk -c 500 -t 12 -d 5s http://localhost:2015/
Running 5s test @ http://localhost:2015/
12 threads and 500 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 13.56ms 18.86ms 188.27ms 87.31%
Req/Sec 5.54k 1.25k 13.05k 74.34%
335088 requests in 5.10s, 73.18MB read
Requests/sec: 65706.52
Transfer/sec: 14.35MB
```

## Apache2:

```
$ wrk -c 500 -t 12 -d 5 http://127.0.0.1:80/
Running 5s test @ http://127.0.0.1:80/
12 threads and 500 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 178.92ms 244.04ms 804.40ms 79.40%
Req/Sec 11.89k 11.40k 36.85k 67.58%
314836 requests in 5.07s, 71.82MB read
Requests/sec: 62124.60
Transfer/sec: 14.17MB
```
46 changes: 32 additions & 14 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,20 +1,38 @@
[package]
name = "binserve"
version = "0.1.0"
authors = ["mufeedvh <[email protected]>"]
edition = "2018"
version = "0.2.0"
edition = "2021"

[dependencies]
futures = "0.3.5"
env_logger = "0.7.1"

actix-web = "3"
actix-files = "0.4.0"

serde = { version = "1.0.116", features = ["derive"] }
serde_json = "1.0.58"

handlebars = "3.5.0"
actix-files = "0.6.0"
actix-web = { version = "4.0.1", features = ["rustls"] }
actix-web-lab = "0.16.1"
ahash = "0.7.6"
anyhow = "1.0.57"
clap = "3.1.18"
colored = "2.0.0"
compact_str = "0.4.0"
dashmap = "5.3.4"
env_logger = "0.9.0"
etag = { version = "3.0.0", features = ["std"] }
handlebars = "4.3.1"
jwalk = "0.6.0"
minify-html-onepass = "0.8.0"
new_mime_guess = "4.0.1"
notify = "4.0.17"
num_cpus = "1.13.1"
once_cell = { version = "1.12.0", features = ["parking_lot"] }
parking_lot = "0.12.1"
rustls = "0.20.6"
rustls-pemfile = "1.0.0"
serde = { version = "1.0.137", features = ["derive"] }
serde_json = "1.0.81"

[profile.release]
lto = true
opt-level = 3
codegen-units = 1
panic = 'abort'
lto = "thin"
debug = false
incremental = false
overflow-checks = false
Loading

0 comments on commit 7c30dd6

Please sign in to comment.