fix(mnesia): поднять dump_log_write_threshold; Traefik base v3.3.6. Refs EventHub/EventHubBack#34 Refs EventHub/EventHubDevOps#3 [skip ci]

This commit is contained in:
2026-07-15 17:28:39 +03:00
parent f7f0038556
commit 94106cf964
4 changed files with 34 additions and 1 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
FROM traefik:v3.2.0 FROM traefik:v3.3.6
ARG CORAZA_VERSION=v0.3.0 ARG CORAZA_VERSION=v0.3.0
ARG CORAZA_MODULE=github.com/jcchavezs/coraza-http-wasm-traefik ARG CORAZA_MODULE=github.com/jcchavezs/coraza-http-wasm-traefik
+1
View File
@@ -47,6 +47,7 @@ start_application() ->
application:set_env(eventhub, extra_db_nodes, Nodes) application:set_env(eventhub, extra_db_nodes, Nodes)
end, end,
application:ensure_all_started(mnesia), application:ensure_all_started(mnesia),
ok = infra_mnesia:configure_dump_log(),
ok = infra_mnesia:init_tables(), ok = infra_mnesia:init_tables(),
ok = infra_mnesia:wait_for_tables(), ok = infra_mnesia:wait_for_tables(),
ok = migration_engine:ensure_applied(), ok = migration_engine:ensure_applied(),
+30
View File
@@ -8,6 +8,7 @@
-export([start_link/0, init_tables/0, wait_for_tables/0, wait_for_table/1]). -export([start_link/0, init_tables/0, wait_for_tables/0, wait_for_table/1]).
-export([add_cluster_nodes/1]). -export([add_cluster_nodes/1]).
-export([configure_dump_log/0]).
-export([init/1, handle_call/3, handle_cast/2, handle_info/2, -export([init/1, handle_call/3, handle_cast/2, handle_info/2,
terminate/2, code_change/3]). terminate/2, code_change/3]).
@@ -44,6 +45,35 @@ wait_for_tables() ->
add_cluster_nodes(Nodes) -> add_cluster_nodes(Nodes) ->
gen_server:call(?MODULE, {add_nodes, Nodes}). gen_server:call(?MODULE, {add_nodes, Nodes}).
%% @doc Soften dump_log overload under write-heavy load (IFT stress).
%% OTP warns {dump_log, write_threshold|time_threshold} when a new dump
%% is requested while the previous dump still runs.
%% Override: MNESIA_DUMP_LOG_WRITE_THRESHOLD (default 50000; OTP default ~1000).
-spec configure_dump_log() -> ok.
configure_dump_log() ->
Threshold = env_int("MNESIA_DUMP_LOG_WRITE_THRESHOLD", 50000),
case mnesia:change_config(dump_log_write_threshold, Threshold) of
{ok, Old} ->
io:format("Mnesia dump_log_write_threshold: ~p -> ~p~n", [Old, Threshold]),
ok;
Other ->
io:format("Mnesia dump_log_write_threshold change failed: ~p~n", [Other]),
ok
end.
env_int(Name, Default) ->
case os:getenv(Name) of
false -> Default;
"" -> Default;
Val ->
try list_to_integer(Val) of
N when N > 0 -> N;
_ -> Default
catch
error:badarg -> Default
end
end.
%% =================================================================== %% ===================================================================
%% gen_server callbacks %% gen_server callbacks
%% =================================================================== %% ===================================================================
+2
View File
@@ -62,6 +62,8 @@ IFT = Docker Swarm **внутри WSL2 на Windows**. Aggressive open-loop бе
**Controlled hold ×3** (`20260715-1411/`, `EVENTHUB_REPLICAS=3`): connect по фазам 0.2→0.035 GREEN (0.05 mean≈40 ms); overall BOUNDARY_HIT из‑за **3772× HTTP 429** — узкое место сместилось на Traefik `api-ratelimit` (per source IP, было 5000/1m≈83 rps). После поднятия IFT-лимитов до 2000/1s (EventHubBack#32) перепроверить hold ×3. **Controlled hold ×3** (`20260715-1411/`, `EVENTHUB_REPLICAS=3`): connect по фазам 0.2→0.035 GREEN (0.05 mean≈40 ms); overall BOUNDARY_HIT из‑за **3772× HTTP 429** — узкое место сместилось на Traefik `api-ratelimit` (per source IP, было 5000/1m≈83 rps). После поднятия IFT-лимитов до 2000/1s (EventHubBack#32) перепроверить hold ×3.
Под hold также: `Mnesia is overloaded: {dump_log, write_threshold|time_threshold}`. Краткосрочно: `MNESIA_DUMP_LOG_WRITE_THRESHOLD` (IFT default 50000, EventHubBack#34). Долгосрочно: меньше sync-транзакций / hot-path вне Mnesia.
Restore fallback: оркестратор → WSL SSH, при fail Windows `restore-ift.ps1`. Restore fallback: оркестратор → WSL SSH, при fail Windows `restore-ift.ps1`.
Если после stress SSH «висит на banner» — **reboot IFT**, затем: Если после stress SSH «висит на banner» — **reboot IFT**, затем: