index : static-web-server.git

ascending towards madness

author Jose Quintana <joseluisquintana20@gmail.com> 2022-10-20 21:02:13.0 +00:00:00
committer Jose Quintana <joseluisquintana20@gmail.com> 2022-10-20 21:02:13.0 +00:00:00
commit
d66494ccaef9ba91ca76ca2703a41f2448b48083 [patch]
tree
22678c4517546a60f1f26196d087d4eab31d8c63
parent
2fc36b47500acc2841694b6172ea27a2178c4895
download
d66494ccaef9ba91ca76ca2703a41f2448b48083.tar.gz

refactor: small project clean up



Diff

 .gitignore              |  4 +---
 Makefile                | 18 ++----------------
 Makefile.toml           | 12 ------------
 benchmark/BENCHMARKS.md |  6 +++---
 sample.env              |  9 ---------
 5 files changed, 6 insertions(+), 43 deletions(-)

diff --git a/.gitignore b/.gitignore
index 5a084e5..db80c83 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,8 +8,7 @@
**/.idea
**/*.txt
**/*.zip
**/*.tar.gz
**/*.tar
**/*.tar*
**/*.gz
**/.DS_Store
**/*.env
@@ -27,7 +26,6 @@ docs/site
docs/*/**.html
*/**/*.1

!sample.env
!/docs
!/tests/fixtures/**/*
!benchmark/sws_benchmarks*.csv
diff --git a/Makefile b/Makefile
index 64fc326..574b7da 100644
--- a/Makefile
+++ b/Makefile
@@ -24,16 +24,6 @@ install:
	@cargo install cargo-audit
.PHONY: install

run:
	@rustc -vV
	@cargo make --makefile Makefile.toml run
.PHONY: run

dev:
	@rustc -vV
	@cargo make --makefile Makefile.toml watch
.PHONY: dev

lint:
	@rustc -vV
	@cargo clippy --all-features -- -D warnings
@@ -277,17 +267,13 @@ docs-deploy:
	@git checkout master
.PHONY: docs-deploy

promote:
	@drone build promote joseluisq/static-web-server $(BUILD) $(ENV)
.PHONY: promote

loadtest:
vegeta:
	@vegeta --version
	@echo "GET http://localhost:8787" | \
		vegeta -cpus=12 attack -workers=12 -connections=500 -rate=6500/s -duration=10s -http2=false > results.bin
	@cat results.bin | vegeta report -type='hist[0,2ms,4ms,6ms]'
	@cat results.bin | vegeta plot > plot.html
.PHONY: loadtest
.PHONY: vegeta

wrk:
	@wrk -c 500 -t 12 -d 10s --latency -s benchmark/wrk_collector.lua $(WRK_URL)
diff --git a/Makefile.toml b/Makefile.toml
deleted file mode 100644
index 5bfe690..0000000
--- a/Makefile.toml
+++ /dev/null
@@ -1,12 +0,0 @@
env_files = [
    { path = "./development.env", profile = "development" },
    { path = "./production.env", profile = "production" }
]

[tasks.watch]
command = "cargo"
args = ["watch", "-cx", "run -- ${E_ARGS}"]

[tasks.run]
command = "cargo"
args = ["run", "--", "${E_ARGS}"]
diff --git a/benchmark/BENCHMARKS.md b/benchmark/BENCHMARKS.md
index 17ac20c..c6f2aa4 100644
--- a/benchmark/BENCHMARKS.md
+++ b/benchmark/BENCHMARKS.md
@@ -2,11 +2,11 @@

> A benchmark suite which measures the requests per second and latency in average for several web servers.

<img title="SWS - Benchmarks 2022" src="data/sws_benchmarks.png" width="860">
<img title="SWS - Benchmarks 2022" src="sws_benchmarks.png" width="860">

## How to use

Change `WRK_URL` with the corresponding server URL to export the wrk metrics.
Change `WRK_URL` env with the corresponding server URL to export the wrk metrics.

```sh
WRK_URL="http://localhost" make wrk
@@ -21,4 +21,4 @@ WRK_URL="http://localhost" make wrk

## Data

For data used see [data]./data/ directory for more details.
For data used see [sws_benchmarks.csv]sws_benchmarks.csv file.
diff --git a/sample.env b/sample.env
deleted file mode 100644
index b5e3be0..0000000
--- a/sample.env
+++ /dev/null
@@ -1,9 +0,0 @@
# Server binary arguments (development)
E_ARGS = "--port=8787"

# Server configuration
SERVER_LOG_LEVEL = "trace"
SERVER_ROOT = "docker/public"
# SERVER_PORT = 8787
SERVER_COMPRESSION = true
SERVER_DIRECTORY_LISTING = true