diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2026-01-16 20:55:38 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2026-01-19 15:03:59 +0000 |
| commit | 16833501a1004a5a661a729e4fd2dbcbeaecd1d5 (patch) | |
| tree | 96117ff6ba6c8d8d1d8daab3afe3f43a04b88e24 | |
| parent | 5897e4bccd41f1a9ebb01a11280cea929c93d2c0 (diff) | |
config: increase max_connections default from 2000 to 4096
Increases connection limit across all configuration sources:
- src/config.rs: default_value_t = 4096
- docs/reference/configuration.md: updated default and examples
- nix/module.nix: maxConnections default = 4096
- .env.example: updated default and comment
This allows the relay to handle more concurrent connections and reduces
the likelihood of connection exhaustion under normal load. The previous
limit of 2000 was too conservative for production deployments.
| -rw-r--r-- | .env.example | 4 | ||||
| -rw-r--r-- | docs/reference/configuration.md | 8 | ||||
| -rw-r--r-- | nix/module.nix | 2 | ||||
| -rw-r--r-- | src/config.rs | 4 |
4 files changed, 9 insertions, 9 deletions
diff --git a/.env.example b/.env.example index 953ae93..a19a07d 100644 --- a/.env.example +++ b/.env.example | |||
| @@ -286,5 +286,5 @@ | |||
| 286 | # Maximum total connections to the relay | 286 | # Maximum total connections to the relay |
| 287 | # Prevents connection exhaustion DoS attacks | 287 | # Prevents connection exhaustion DoS attacks |
| 288 | # CLI: --max-connections <count> | 288 | # CLI: --max-connections <count> |
| 289 | # Default: 500 | 289 | # Default: 4096 |
| 290 | # NGIT_MAX_CONNECTIONS=500 \ No newline at end of file | 290 | # NGIT_MAX_CONNECTIONS=4096 \ No newline at end of file |
diff --git a/docs/reference/configuration.md b/docs/reference/configuration.md index c3001d3..c1cb712 100644 --- a/docs/reference/configuration.md +++ b/docs/reference/configuration.md | |||
| @@ -931,17 +931,17 @@ Event blacklist does **not** affect NIP-11 metadata: | |||
| 931 | 931 | ||
| 932 | **Description:** Maximum total connections to the relay. Prevents connection exhaustion DoS attacks. | 932 | **Description:** Maximum total connections to the relay. Prevents connection exhaustion DoS attacks. |
| 933 | **Type:** Integer | 933 | **Type:** Integer |
| 934 | **Default:** `500` | 934 | **Default:** `4096` |
| 935 | **Required:** No | 935 | **Required:** No |
| 936 | 936 | ||
| 937 | **Examples:** | 937 | **Examples:** |
| 938 | 938 | ||
| 939 | ```bash | 939 | ```bash |
| 940 | # Default: 500 connections | 940 | # Default: 4096 connections |
| 941 | NGIT_MAX_CONNECTIONS=500 | 941 | NGIT_MAX_CONNECTIONS=4096 |
| 942 | 942 | ||
| 943 | # Higher limit for large public relay | 943 | # Higher limit for large public relay |
| 944 | NGIT_MAX_CONNECTIONS=1000 | 944 | NGIT_MAX_CONNECTIONS=8000 |
| 945 | 945 | ||
| 946 | # Lower limit for private relay | 946 | # Lower limit for private relay |
| 947 | NGIT_MAX_CONNECTIONS=100 | 947 | NGIT_MAX_CONNECTIONS=100 |
diff --git a/nix/module.nix b/nix/module.nix index 4117b6d..5debc9e 100644 --- a/nix/module.nix +++ b/nix/module.nix | |||
| @@ -252,7 +252,7 @@ let | |||
| 252 | 252 | ||
| 253 | maxConnections = mkOption { | 253 | maxConnections = mkOption { |
| 254 | type = types.int; | 254 | type = types.int; |
| 255 | default = 500; | 255 | default = 4096; |
| 256 | description = "Maximum total connections to the relay"; | 256 | description = "Maximum total connections to the relay"; |
| 257 | }; | 257 | }; |
| 258 | 258 | ||
diff --git a/src/config.rs b/src/config.rs index 0014003..320661f 100644 --- a/src/config.rs +++ b/src/config.rs | |||
| @@ -470,9 +470,9 @@ pub struct Config { | |||
| 470 | #[arg(long, env = "NGIT_EVENT_BLACKLIST", default_value = "")] | 470 | #[arg(long, env = "NGIT_EVENT_BLACKLIST", default_value = "")] |
| 471 | pub event_blacklist: String, | 471 | pub event_blacklist: String, |
| 472 | 472 | ||
| 473 | /// Maximum total connections to the relay (default: 500) | 473 | /// Maximum total connections to the relay (default: 4096) |
| 474 | /// Prevents connection exhaustion DoS attacks | 474 | /// Prevents connection exhaustion DoS attacks |
| 475 | #[arg(long, env = "NGIT_MAX_CONNECTIONS", default_value_t = 500)] | 475 | #[arg(long, env = "NGIT_MAX_CONNECTIONS", default_value_t = 4096)] |
| 476 | pub max_connections: usize, | 476 | pub max_connections: usize, |
| 477 | } | 477 | } |
| 478 | 478 | ||