Does Ocelot support sharing routes and rate limit configurations between its instances if we deploy more than one Ocelot instance? #2098
-
Expected Behavior / New FeatureI want to publish two instance of Ocelot at different servers but the under the same domain "Routes": [
{
"DownstreamPathTemplate": "/product",
"DownstreamScheme": "https",
"DownstreamHostAndPorts": [
{
"Host": "products.com",
"Port": 44322
}
],
"UpstreamPathTemplate": "/api/product",
"UpstreamHttpMethod": [ "POST" ],
"RouteIsCaseSensitive": true,
"RateLimitOptions": {
"ClientWhitelist": [],
"EnableRateLimiting": true,
"Period": "60s",
"PeriodTimespan": 60,
"Limit": 1
}
}
]
"GlobalConfiguration": {
"BaseUrl": "https://api.products",
"RateLimitOptions": {
"DisableRateLimitHeaders": false,
"QuotaExceededMessage": "Too Many Requests At Short Duration!",
"HttpStatusCode": 429
}
} What should happen is
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 9 replies
-
The short answer is NO. Each Ocelot instance counts requests independently for rate limiting due to its internal cache storage. However, if you configure your instance to use a distributed cache, then the rate limiting counters will store values in this distributed cache storage. Therefore, you should use a distributed cache, as Ocelot does not have the capability to allow one instance to share its internal cache with other instances. Nonetheless, this could be an interesting feature to explore further. |
Beta Was this translation helpful? Give feedback.
The short answer is NO.
Each Ocelot instance counts requests independently for rate limiting due to its internal cache storage. However, if you configure your instance to use a distributed cache, then the rate limiting counters will store values in this distributed cache storage.
Therefore, you should use a distributed cache, as Ocelot does not have the capability to allow one instance to share its internal cache with other instances. Nonetheless, this could be an interesting feature to explore further.