Skip to content

Commit 3db08e6

Browse files
authored
add benchmark facilities (#2107)
- Add Mix.Tasks.Benchmark - Add Sequin.Bench.Stats Tested and working with `--through reorder_buffer` and `--through sps`
1 parent 3fdb0d5 commit 3db08e6

19 files changed

Lines changed: 1582 additions & 32 deletions

File tree

AGENTS.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ These commands should pass before committing. Warnings or noise in test is not a
4646
- For fast feedback, run `mix test --exclude unboxed`. This skips synchronous tests. Then run `mix test` at the end to validate your work.
4747
- New tests that you create MUST NOT generate extra logs, even if the tests pass.
4848

49+
## Testing
50+
51+
### No `Process.sleep`
52+
53+
Process.sleep is not allowed in test. You can use temporarily to get things working. But then find a way to use signal passing or telemetry handlers to get rid of it.
54+
4955
## Using jj workspaces for isolated work
5056

5157
When working on a feature or fix, you can create an isolated workspace using jj:

config/bench.exs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import Config
2+
3+
config :sequin, Oban, testing: :manual, prefix: "sequin_config"
4+
5+
config :sequin, Sequin.Repo,
6+
username: "postgres",
7+
password: "postgres",
8+
hostname: "localhost",
9+
database: "sequin_bench",
10+
stacktrace: true,
11+
show_sensitive_data_on_connection_error: true,
12+
pool_size: 50
13+
14+
config :sequin, Sequin.Vault,
15+
ciphers: [
16+
default: {
17+
Cloak.Ciphers.AES.GCM,
18+
tag: "AES.GCM.V1", key: Base.decode64!("ZTu2hzCwKYbeNea+8+Y2p0CBXpWusF6agpsZlQsVVi0="), iv_length: 12
19+
}
20+
]
21+
22+
config :sequin, SequinWeb.Endpoint,
23+
http: [ip: {127, 0, 0, 1}, port: 4002],
24+
secret_key_base: "erV7XavfZn9wH6ZOort1IThbuZRv6q3FrG5JjgQfCqe9dyVLkKmi1yxZ9X2DaUy4",
25+
server: false
26+
27+
config :sequin,
28+
env: :bench,
29+
ecto_repos: [Sequin.Repo]
30+
31+
config :swoosh, :api_client, false

config/runtime.exs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ metrics_auth =
3636
]
3737
end
3838

39+
config :sequin, Sequin.Benchmark.Stats, track_messages: System.get_env("BENCHMARK_TRACK_MESSAGES") == "true"
3940
config :sequin, :metrics_basic_auth, metrics_auth
4041

4142
if System.get_env("PORT") do

0 commit comments

Comments
 (0)