Using Redis with API throttling
Martini's throttling feature allows you to limit the number of allowed service invocations within a specified amount of time. To do this, Martini needs to keep a record of service invocations that have already occurred. By default, Martini stores this data in an in-memory data store, but it's possible to configure Martini to use Redis instead.
Production environments and throttling
If you are throttling API requests in a production or heavy-load environment, it's recommended to use Redis.
To use Redis:
-
Create a Redis database connection and name it
monitor-redis
.Check your license
Your license must offer Redis support in order to create a Redis database connection.
-
Update the application property
throttling.datastore-type
so that its value isredis
.1
throttling.datastore-type=redis
-
Restart your instance. If successful, you should be able to see this log message in the console:
1
05/08/19 14:56:51.556 INFO [ThrottlingBeanConfig] Using redis Throttling datastore for Throttling API