You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+48-4Lines changed: 48 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,8 @@ A lightweight, low-latency RPC load balancer written in Go. It is designed to ma
5
5
## Features
6
6
7
7
-**Round-Robin Load Balancing**: Distributes requests to available endpoints in a round-robin manner, prioritizing those with fewer requests in the last 24 hours.
8
-
-**Intelligent Retry Logic**: Configurable retry attempts with priority-based endpoint selection (first primary endpoints, then fallbacks).
8
+
-**Intelligent Retry Logic**: Configurable retry attempts with priority-based endpoint selection (primary endpoints, fallbacks, and optional public-first mode).
9
+
-**Public-First Mode**: Optional prioritization of public RPC endpoints to reduce costs while maintaining reliability.
9
10
-**Flexible Timeout Control**: Separate timeouts for overall requests and individual retry attempts.
10
11
-**Rate Limit Recovery**: Safe rate limit detection and recovery with exponential backoff strategies per endpoint, to avoid making things worse when a provider is rate-limiting you.
11
12
-**Health Checks**: Regularly checks the health of upstream endpoints and updates their status in Redis.
@@ -109,10 +110,13 @@ The load balancer implements intelligent retry logic with configurable timeouts:
109
110
110
111
### How Retries Work
111
112
112
-
1.**Priority-based selection**: Always tries primary endpoints first, then fallbacks.
113
+
1.**Priority-based selection**: Endpoint selection follows these priorities:
114
+
-**Normal mode**: primary → fallback → public
115
+
-**Public-first mode** (`PUBLIC_FIRST=true`): public → primary → fallback
113
116
2.**Configurable attempts**: Retries up to `PROXY_MAX_RETRIES` times.
114
-
3.**Endpoint rotation**: Removes failed endpoints from the retry pool to avoid repeated failures.
115
-
4.**Dual timeout control**: There are 2 settings that control how long requests take:
117
+
3.**Public endpoint limiting**: When `PUBLIC_FIRST=true`, attempts to reach public endpoints are limited to the value of `PUBLIC_FIRST_ATTEMPTS`, after which the proxy tries using a primary or fallback endpoint.
118
+
4.**Endpoint rotation**: Removes failed endpoints from the retry pool to avoid repeated failures.
119
+
5.**Dual timeout control**: There are 2 settings that control how long requests take:
116
120
-**Total request timeout** (`PROXY_TIMEOUT`): Maximum time for the entire request (this is what the end user "sees").
117
121
-**Per-try timeout** (`PROXY_TIMEOUT_PER_TRY`): Maximum time per individual request sent from the proxy to each endpoint.
118
122
@@ -141,6 +145,8 @@ The load balancer implements intelligent retry logic with configurable timeouts:
141
145
|`--proxy-retries`|`3`| Maximum number of retries for proxy requests |
142
146
|`--proxy-timeout`|`15`| Total timeout for proxy requests in seconds |
143
147
|`--proxy-timeout-per-try`|`5`| Timeout per individual retry attempt in seconds |
148
+
|`--public-first`|`false`| Prioritize public endpoints over primary endpoints |
149
+
|`--public-first-attempts`|`2`| Number of attempts to make at public endpoints before trying primary/fallback |
144
150
|`--redis-host`|`localhost`| Redis server hostname |
145
151
|`--redis-pass`| - | Redis server password |
146
152
|`--redis-port`|`6379`| Redis server port |
@@ -170,6 +176,8 @@ The load balancer implements intelligent retry logic with configurable timeouts:
170
176
|`PROXY_MAX_RETRIES`|`3`| Maximum number of retries for proxy requests |
171
177
|`PROXY_TIMEOUT`|`15`| Total timeout for proxy requests in seconds |
172
178
|`PROXY_TIMEOUT_PER_TRY`|`5`| Timeout per individual retry attempt in seconds |
179
+
|`PUBLIC_FIRST`|`false`| Prioritize public endpoints over primary and fallback endpoints |
180
+
|`PUBLIC_FIRST_ATTEMPTS`|`2`| Number of attempts to make at public endpoints before trying with a primary/fallback |
173
181
|`REDIS_HOST`|`localhost`| Redis server hostname |
174
182
|`REDIS_PASS`| - | Redis server password |
175
183
|`REDIS_PORT`|`6379`| Redis server port |
@@ -215,6 +223,42 @@ For production deployments with multiple load balancer pods, use the standalone
-**Better Separation of Concerns**: Health monitoring isolated from request handling
217
225
226
+
## Public-First Mode
227
+
228
+
Ætherlay supports a "public-first" mode that prioritizes public RPC endpoints over primary and fallback endpoints to help reduce costs while maintaining reliability.
229
+
230
+
### How Public-First Mode Works
231
+
232
+
1.**Enable public-first**: Set `PUBLIC_FIRST=true` (or use the `--public-first` CLI flag)
233
+
2.**Configure attempts**: Set `PUBLIC_FIRST_ATTEMPTS` to control how many public endpoints to try (default: 2)
234
+
3.**Endpoint hierarchy**:
235
+
-**When enabled**: public → primary → fallback
236
+
-**When disabled**: primary → fallback → public
237
+
238
+
### Configuration Example
239
+
240
+
In your `endpoints.json`, mark endpoints with `"role": "public"`:
Ætherlay includes intelligent rate limit detection and recovery mechanisms to handle upstream provider rate limits gracefully. This system automatically detects when endpoints are rate-limited and implements recovery strategies to restore service.
0 commit comments