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: content/features/proxy/examples.md
+91Lines changed: 91 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -283,3 +283,94 @@ routes{
283
283
default=route_direct{ child="main" }
284
284
}
285
285
```
286
+
287
+
## Gutter failover for downed backends
288
+
289
+
This is an example for reducing the impact of a downed cache server.
290
+
291
+
For example, we have a list of three cache servers in a pool: a, b, c
292
+
If cache node 'b' fails, clients will receive errors until the 'b' server
293
+
is replaced.
294
+
295
+
With this example, we use the failover and ttl adjusting routes to allow
296
+
temporarily rerouting cache requests while a server is failed. We do this first by "failing over" the request from the bad server to another server, with several optional approaches.
297
+
298
+
Next, if a request has failed over, we adjust the TTL of any 'set' commands
299
+
to be lower. In this example we use five minutes. This prevents cache
300
+
entires that have "failed over" from staying around for a long period of
301
+
time, which can cause issues if server 'b' repeatedly fails.
302
+
303
+
The short cache time should allow a good hit rate for objects which are
304
+
immediately being reused (ie; a user browsing around a website, or rate
305
+
limit counters).
306
+
307
+
Q&A:
308
+
- Do we need to copy all deletes to the gutter pool?
309
+
- If a sufficiently low TTL is used and servers do not typically flap,
310
+
no. Depending on your setup you might have to.
311
+
- What about touch/gat commands?
312
+
- This will depend on your needs. Please contact us if you have questions
313
+
here.
314
+
- How do we handle backends that are flapping (ie; sometimes timing out but
315
+
not competely dead?
316
+
- You can adjust "anti flap" settings, which will force a backend to
317
+
stay down with a backoff algorithm:
318
+
```lua
319
+
settings{
320
+
backend_flap_time=30, -- stable for 30 seconds means not flapping
321
+
backend_flap_backoff_ramp=1.2, -- multipler for backoff wait time
322
+
backend_flap_backoff_max=3600, -- try at least once an hour
323
+
}
324
+
```
325
+
326
+
Gutter example config:
327
+
328
+
```lua
329
+
localbe_list= {
330
+
"127.0.0.1:11214",
331
+
"127.0.0.1:11215",
332
+
"127.0.0.1:11216",
333
+
}
334
+
335
+
pools{
336
+
main= {
337
+
backends=be_list,
338
+
},
339
+
-- for one example, we use a dedicated gutter pool. This server will be
340
+
-- idle unless another server has failed or is being serviced.
341
+
gutter= {
342
+
backends= { "127.1.0.0.1:11311" }
343
+
},
344
+
-- in this example, we reuse the main set of backends, but change the key
345
+
-- hashing seed so keys will map to the list of backends differently. This
346
+
-- can minimize server maintenance while avoiding having idle "gutter"
347
+
-- servers.
348
+
-- The downside is keys may map to the same place, especially if you have
349
+
-- a small list of backends. This can be partly mitigated by having
350
+
-- multiple gutters with different seeds and failing several times.
351
+
-- There may still be keys that fail but they will hopefully be few and
352
+
-- the service can survive until the cache node is restored.
353
+
--
354
+
-- To use this, replace "gutter" below with "gutter_same"
0 commit comments