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
+40-5
Original file line number
Diff line number
Diff line change
@@ -20,6 +20,9 @@
20
20
-[Request Fields](#request-fields)
21
21
-[Statistics](#statistics)
22
22
-[Debug Port](#debug-port)
23
+
-[Redis](#redis)
24
+
-[One Redis Instance](#one-redis-instance)
25
+
-[Two Redis Instances](#two-redis-instances)
23
26
-[Contact](#contact)
24
27
25
28
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
@@ -28,7 +31,7 @@
28
31
29
32
The rate limit service is a Go/gRPC service designed to enable generic rate limit scenarios from different types of
30
33
applications. Applications request a rate limit decision based on a domain and a set of descriptors. The service
31
-
reads the configuration from disk via [runtime](https://github.com/lyft/goruntime), composes a cache key, and talks to the redis cache. A
34
+
reads the configuration from disk via [runtime](https://github.com/lyft/goruntime), composes a cache key, and talks to the Redis cache. A
32
35
decision is then returned to the caller.
33
36
34
37
# Deprecation of Legacy Ratelimit Proto
@@ -55,13 +58,13 @@ to give time to community members running ratelimit off of `master`.
55
58
56
59
# Building and Testing
57
60
58
-
* Install redis-server.
61
+
* Install Redis-server.
59
62
* Make sure go is setup correctly and checkout rate limit service into your go path. More information about installing
60
63
go [here](https://golang.org/doc/install).
61
-
* In order to run the integration tests using a local default redis install you will also need these environment variables set:
64
+
* In order to run the integration tests using a local Redis server please run two Redis-server instances: one on port `6379` and another on port `6380`
62
65
```bash
63
-
export REDIS_SOCKET_TYPE=tcp
64
-
export REDIS_URL=localhost:6379
66
+
Redis-server --port 6379 &
67
+
Redis-server --port 6380 &
65
68
```
66
69
* To setup for the first time (only done once):
67
70
```bash
@@ -352,6 +355,38 @@ $ curl 0:6070/
352
355
353
356
You can specify the debug port with the `DEBUG_PORT` environment variable. It defaults to `6070`.
354
357
358
+
# Redis
359
+
360
+
Ratelimit uses Redis as its caching layer. Ratelimit supports two operation modes:
361
+
362
+
1. One Redis server for all limits.
363
+
1. Two Redis instances: one for per second limits and another one for all other limits.
364
+
365
+
## One Redis Instance
366
+
367
+
To configure one Redis instance use the following environment variables:
368
+
369
+
1.`REDIS_SOCKET_TYPE`
370
+
1.`REDIS_URL`
371
+
1.`REDIS_POOL_SIZE`
372
+
373
+
This setup will use the same Redis server for all limits.
374
+
375
+
## Two Redis Instances
376
+
377
+
To configure two Redis instances use the following environment variables:
378
+
379
+
1.`REDIS_SOCKET_TYPE`
380
+
1.`REDIS_URL`
381
+
1.`REDIS_POOL_SIZE`
382
+
1.`REDIS_PERSECOND`: set this to `"true"`.
383
+
1.`REDIS_PERSECOND_SOCKET_TYPE`
384
+
1.`REDIS_PERSECOND_URL`
385
+
1.`REDIS_PERSECOND_POOL_SIZE`
386
+
387
+
This setup will use the Redis server configured with the `_PERSECOND_` vars for
388
+
per second limits, and the other Redis server for all other limits.
389
+
355
390
# Contact
356
391
357
392
*[envoy-announce](https://groups.google.com/forum/#!forum/envoy-announce): Low frequency mailing
0 commit comments