diff --git a/BENCHMARK.md b/BENCHMARK.md index 26a53ed..865b0ef 100644 --- a/BENCHMARK.md +++ b/BENCHMARK.md @@ -1,6 +1,6 @@ Running 2 comparison run(s)... Versions: - parrhesia 0.3.0 + parrhesia 0.4.0 strfry 1.0.4 (nixpkgs) nostr-rs-relay 0.9.0 nostr-bench 0.4.0 @@ -16,18 +16,18 @@ Versions: === Bench comparison (averages) === metric parrhesia strfry nostr-rs-relay strfry/parrhesia nostr-rs/parrhesia -------------------------- --------- -------- -------------- ---------------- ------------------ -connect avg latency (ms) ↓ 13.50 3.00 2.00 0.22x 0.15x -connect max latency (ms) ↓ 22.50 5.50 3.00 0.24x 0.13x -echo throughput (TPS) ↑ 80385.00 61673.00 164516.00 0.77x 2.05x -echo throughput (MiB/s) ↑ 44.00 34.45 90.10 0.78x 2.05x -event throughput (TPS) ↑ 2000.00 3404.50 788.00 1.70x 0.39x -event throughput (MiB/s) ↑ 1.30 2.20 0.50 1.69x 0.38x -req throughput (TPS) ↑ 3664.00 1808.50 877.50 0.49x 0.24x -req throughput (MiB/s) ↑ 20.75 11.75 2.45 0.57x 0.12x +connect avg latency (ms) ↓ 10.50 4.00 3.00 0.38x 0.29x +connect max latency (ms) ↓ 19.50 7.50 4.00 0.38x 0.21x +echo throughput (TPS) ↑ 78520.00 60353.00 164420.50 0.77x 2.09x +echo throughput (MiB/s) ↑ 43.00 33.75 90.05 0.78x 2.09x +event throughput (TPS) ↑ 1919.50 3520.50 781.00 1.83x 0.41x +event throughput (MiB/s) ↑ 1.25 2.25 0.50 1.80x 0.40x +req throughput (TPS) ↑ 4608.50 1809.50 875.50 0.39x 0.19x +req throughput (MiB/s) ↑ 26.20 11.75 2.40 0.45x 0.09x Legend: ↑ higher is better, ↓ lower is better. Ratio columns are server/parrhesia (for ↓ metrics, <1.00x means that server is faster). Run details: - run 1: parrhesia(echo_tps=81402, event_tps=1979, req_tps=3639, connect_avg_ms=14) | strfry(echo_tps=61745, event_tps=3457, req_tps=1818, connect_avg_ms=3) | nostr-rs-relay(echo_tps=159974, event_tps=784, req_tps=905, connect_avg_ms=2) - run 2: parrhesia(echo_tps=79368, event_tps=2021, req_tps=3689, connect_avg_ms=13) | strfry(echo_tps=61601, event_tps=3352, req_tps=1799, connect_avg_ms=3) | nostr-rs-relay(echo_tps=169058, event_tps=792, req_tps=850, connect_avg_ms=2) + run 1: parrhesia(echo_tps=78892, event_tps=1955, req_tps=4671, connect_avg_ms=10) | strfry(echo_tps=59132, event_tps=3462, req_tps=1806, connect_avg_ms=4) | nostr-rs-relay(echo_tps=159714, event_tps=785, req_tps=873, connect_avg_ms=3) + run 2: parrhesia(echo_tps=78148, event_tps=1884, req_tps=4546, connect_avg_ms=11) | strfry(echo_tps=61574, event_tps=3579, req_tps=1813, connect_avg_ms=4) | nostr-rs-relay(echo_tps=169127, event_tps=777, req_tps=878, connect_avg_ms=3) diff --git a/README.md b/README.md index 86ff9e2..60b953a 100644 --- a/README.md +++ b/README.md @@ -384,7 +384,7 @@ Current comparison results from [BENCHMARK.md](./BENCHMARK.md): Higher is better for `↑` metrics. Lower is better for `↓` metrics. -(Results from a Linux container on a 6-core Intel i5-8400T with NVMe drive) +(Results from a Linux container on a 6-core Intel i5-8400T with NVMe drive, PostgreSQL 18) --- diff --git a/default.nix b/default.nix index a26f427..f3a8a71 100644 --- a/default.nix +++ b/default.nix @@ -10,7 +10,7 @@ vips, }: let pname = "parrhesia"; - version = "0.3.0"; + version = "0.4.0"; beamPackages = beam.packages.erlang_28.extend ( final: _prev: { @@ -48,7 +48,7 @@ beamPackages.fetchMixDeps { pname = "${pname}-mix-deps"; inherit version src; - hash = "sha256-0KOyYRbYM0jjmp3tPn64qkp0YkmZKlqkGrlu/wCr4m8="; + hash = "sha256-I09Q2PG22lOrZjjXoq8Py3P3o5dgaz9LhKJSmP+/r6k="; } else null; diff --git a/devenv.nix b/devenv.nix index cf32a82..c76e5e3 100644 --- a/devenv.nix +++ b/devenv.nix @@ -106,12 +106,6 @@ in { strfry ]; - # https://devenv.sh/tests/ - # enterTest = '' - # echo "Running tests" - # git --version | grep "2.42.0" - # ''; - # https://devenv.sh/languages/ languages = { elixir = { @@ -131,7 +125,7 @@ in { enable = true; package = pkgs.postgresql_18; - # Some tuning for the benchmark + # Some tuning for the benchmark - doesn't seem to do much settings = { max_connections = 300; shared_buffers = "1GB"; @@ -151,6 +145,7 @@ in { initialScript = '' CREATE ROLE dev WITH LOGIN PASSWORD 'dev' SUPERUSER; + -- Make sure we get the right collation ALTER database template1 is_template=false; DROP database template1; @@ -167,12 +162,10 @@ in { ''; }; - # https://devenv.sh/pre-commit-hooks/ - # pre-commit.hooks.shellcheck.enable = true; - dotenv.enable = true; devenv.warnOnNewVersion = false; + # https://devenv.sh/pre-commit-hooks/ git-hooks.hooks = { alejandra.enable = true; check-added-large-files = { diff --git a/mix.exs b/mix.exs index 0e867cd..484db2a 100644 --- a/mix.exs +++ b/mix.exs @@ -4,7 +4,7 @@ defmodule Parrhesia.MixProject do def project do [ app: :parrhesia, - version: "0.3.0", + version: "0.4.0", elixir: "~> 1.19", start_permanent: Mix.env() == :prod, deps: deps(), diff --git a/mix.lock b/mix.lock index 7f71e45..f824eca 100644 --- a/mix.lock +++ b/mix.lock @@ -27,7 +27,7 @@ "plug_cowboy": {:hex, :plug_cowboy, "2.8.0", "07789e9c03539ee51bb14a07839cc95aa96999fd8846ebfd28c97f0b50c7b612", [:mix], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:cowboy_telemetry, "~> 0.3", [hex: :cowboy_telemetry, repo: "hexpm", optional: false]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "9cbfaaf17463334ca31aed38ea7e08a68ee37cabc077b1e9be6d2fb68e0171d0"}, "plug_crypto": {:hex, :plug_crypto, "2.1.1", "19bda8184399cb24afa10be734f84a16ea0a2bc65054e23a62bb10f06bc89491", [:mix], [], "hexpm", "6470bce6ffe41c8bd497612ffde1a7e4af67f36a15eea5f921af71cf3e11247c"}, "postgrex": {:hex, :postgrex, "0.22.0", "fb027b58b6eab1f6de5396a2abcdaaeb168f9ed4eccbb594e6ac393b02078cbd", [:mix], [{:db_connection, "~> 2.9", [hex: :db_connection, repo: "hexpm", optional: false]}, {:decimal, "~> 1.5 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:table, "~> 0.1.0", [hex: :table, repo: "hexpm", optional: true]}], "hexpm", "a68c4261e299597909e03e6f8ff5a13876f5caadaddd0d23af0d0a61afcc5d84"}, - "ranch": {:hex, :ranch, "1.8.1", "208169e65292ac5d333d6cdbad49388c1ae198136e4697ae2f474697140f201c", [:make, :rebar3], [], "hexpm", "aed58910f4e21deea992a67bf51632b6d60114895eb03bb392bb733064594dd0"}, + "ranch": {:hex, :ranch, "2.2.0", "25528f82bc8d7c6152c57666ca99ec716510fe0925cb188172f41ce93117b1b0", [:make, :rebar3], [], "hexpm", "fa0b99a1780c80218a4197a59ea8d3bdae32fbff7e88527d7d8a4787eff4f8e7"}, "req": {:hex, :req, "0.5.17", "0096ddd5b0ed6f576a03dde4b158a0c727215b15d2795e59e0916c6971066ede", [:mix], [{:brotli, "~> 0.3.1", [hex: :brotli, repo: "hexpm", optional: true]}, {:ezstd, "~> 1.0", [hex: :ezstd, repo: "hexpm", optional: true]}, {:finch, "~> 0.17", [hex: :finch, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:mime, "~> 2.0.6 or ~> 2.1", [hex: :mime, repo: "hexpm", optional: false]}, {:nimble_csv, "~> 1.0", [hex: :nimble_csv, repo: "hexpm", optional: true]}, {:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm", "0b8bc6ffdfebbc07968e59d3ff96d52f2202d0536f10fef4dc11dc02a2a43e39"}, "rewrite": {:hex, :rewrite, "1.3.0", "67448ba7975690b35ba7e7f35717efcce317dbd5963cb0577aa7325c1923121a", [:mix], [{:glob_ex, "~> 0.1", [hex: :glob_ex, repo: "hexpm", optional: false]}, {:sourceror, "~> 1.0", [hex: :sourceror, repo: "hexpm", optional: false]}, {:text_diff, "~> 0.1", [hex: :text_diff, repo: "hexpm", optional: false]}], "hexpm", "d111ac7ff3a58a802ef4f193bbd1831e00a9c57b33276e5068e8390a212714a5"}, "sourceror": {:hex, :sourceror, "1.12.0", "da354c5f35aad3cc1132f5d5b0d8437d865e2661c263260480bab51b5eedb437", [:mix], [], "hexpm", "755703683bd014ebcd5de9acc24b68fb874a660a568d1d63f8f98cd8a6ef9cd0"},