问题描述
在一个API捆绑包中,我们有3个不同的流(例如,流A,流B和流C),并且它们都引用相同的名为QuotaLimitPolicy的配额策略.他们真的为给定的标识符使用单独的计数器吗?
Say within an API bundle, we have 3 different flows (e.g., flow A, flow B, and flow C), and they all reference the same Quota policy named QuotaLimitPolicy. Are they really using separate counters for a given Identifier?
Flow A is executed -> QuotaLimitPolicy is executed. Result: "A counter" = 1
Flow B is executed -> QuotaLimitPolicy is executed. Result: "B counter" = 1
Flow A is executed -> QuotaLimitPolicy is executed. Result: "A counter" = 1 +1 = 2
Flow C is executed -> QuotaLimitPolicy is executed. Result: "C counter" = 1
Flow A is executed -> QuotaLimitPolicy is executed. Result: "A counter" = 2 +1 = 3
更笼统地说,除了标识符之外,是什么使配额计数器与众不同?
More generally, what makes a quota counter distinct in addition to the Identifier?
推荐答案
Flow A is executed -> QuotaLimitPolicy is executed. Result: "A counter" = 1
Flow B is executed -> QuotaLimitPolicy is executed. Result: "B counter" = 1
Flow A is executed -> QuotaLimitPolicy is executed. Result: "A counter" = 1 +1 = 2
Flow C is executed -> QuotaLimitPolicy is executed. Result: "C counter" = 1
Flow A is executed -> QuotaLimitPolicy is executed. Result: "A counter" = 2 +1 = 3
否,仅维护1个.在捆绑软件中,对相同策略的所有引用都使用相同的计数器.在上面的示例中,QuotaLimitPolicy实际上是给定标识符的单个计数器.因此,对于单个标识符(例如,client_id = 10.10.10.10),上面的链将导致单个计数器的值为5,每次执行QuotaLimitPolicy都为一个.
No, only 1 is maintained. Within a bundle, all references to the same policy use the same counter. In the example above, QuotaLimitPolicy is really a single counter for a given Identifier. So for a single Identifier (say, client_id = 10.10.10.10), the chain above would result in a single counter with a value of 5, one for each execution of QuotaLimitPolicy.
区别在于每个API捆绑包的 策略名称级别 .如果要为同一捆绑包中的各种流创建单独的计数器,则需要使用不同的"name =" 属性创建单独的策略.此外,我不相信我可以使用配额策略在给定的环境中跨多个API包共享一个配额计数器.
The distinction is at the policy name level per API bundle. If you want to create separate counters for various flows in the same bundle, you need to create separate policies with different "name=" attributes.Furthermore, I don't believe I can share a single quota counter across multiple API bundles for a given environment using the Quota policy.
这些不是好事还是坏事,但是,我想引起人们的注意,以便在解决方案设计中考虑这些问题.
These are not good or bad things, but rather, I'd like to bring awareness so that these are considered in solution designs.
这篇关于配额计数器:是什么使它们与众不同? “标识符"字段上方是否还有其他过滤器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!