Rate Limiting速率限制

来源:互联网 发布:mac英文如何设置成中文 编辑:程序博客网 时间:2024/05/19 23:14

Rate Limiting速率限制

Rate limiting in swift isimplemented as a pluggable middleware. Rate limiting is performed on requeststhat result in database writes to the account and container sqlite dbs. It usesmemcached and is dependent on the proxy servers having highly synchronizedtime. The rate limits are limited by the accuracy of the proxy server clocks.

速率限制在swift中是作为一个可插的中间件。速率限制处理在数据库写操作到账号和容器sqlite db的请求。它使用memcached并且依赖于高度同步时间的代理服务器。速率限制受限于代理服务器时钟的精度。

Configuration配置

All configuration isoptional. If no account or container limits are provided there will be no ratelimiting. Configuration available:

所有的配置是可选的。如果没有给出账号或容器的限制,那么就没有速率限制。可用配置参数如下:

Option

Default

Description

clock_accuracy

1000

Represents how accurate the proxy servers’ system clocks are with each other. 1000 means that all the proxies’ clock are accurate to each other within 1 millisecond. No ratelimit should be higher than the clock accuracy.

表示代理服务器的系统时钟相互之间的精度。1000表示所有的代理相互之间的时钟精确到毫秒。没有速率限制应该比该时钟精度更高。

max_sleep_time_seconds

60

App will immediately return a 498 response if the necessary sleep time ever exceeds the given max_sleep_time_seconds.

如果必须的休眠时间超过了给定的max_sleep_time_seconds,应用程序会立刻返回一个498响应

log_sleep_time_seconds

0

To allow visibility into rate limiting set this value > 0 and all sleeps greater than the number will be logged.

在速率限制中考虑可见性,设置这一值大于0并且所有的休眠时间大于这个数值得将被记录。

rate_buffer_seconds

5

Number of seconds the rate counter can drop and be allowed to catch up (at a faster than listed rate). A larger number will result in larger spikes in rate but better average accuracy.

速度计数器终止并允许追赶的秒数(以一个比已登录更快的速度)。一个更大的数将会在速率上产生更大的峰值但是更好的平均精度。

account_ratelimit

0

If set, will limit PUT and DELETE requests to /account_name/container_name. Number is in requests per second.

如果设置,将会限制PUT和DELETE到account_name/container_name请求。数值为每秒的请求数。

container_ratelimit_size

‘’

When set with container_ratelimit_x = r: for containers of size x, limit requests per second to r. Will limit PUT, DELETE, and POST requests to /a/c/o.

当设置为container_limit_x = r :对于大小为x的容器,限制的请求数为r次每秒。使用/a/c/o来限制PUT,DELETE和POST请求。

container_listing_ratelimit_size

‘’

When set with container_listing_ratelimit_x = r: for containers of size x, limit listing requests per second to r. Will limit GET requests to /a/c.

The container rate limitsare linearly interpolated from the values given. A sample container rate limitingcould be:

容器的速率限制从给定值线性地插入。一个容器速率限制的样例如下:

container_ratelimit_100 =100

container_ratelimit_200 =50

container_ratelimit_500 =20

This would result in

Container Size

Rate Limit

0-99

No limiting

100

100

150

75

500

20

1000

20

AccountSpecific Ratelimiting

The above ratelimiting isto prevent the “many writes to a single container” bottleneck from causing aproblem. There could also be a problem where a single account is just using toomuch of the cluster’s resources. In this case, the container ratelimits may nothelp because the customer could be doing thousands of reqs/sec to distributed containerseach getting a small fraction of the total so those limits would never trigger.If a system administrator notices this, he/she can set theX-Account-Sysmeta-Global-Write-Ratelimit on an account and that will limit thetotal number of write requests (PUT, POST, DELETE, COPY) that account can dofor the whole account. This limit will be in addition to the applicableaccount/container limits from above. This header will be hidden from the user,because of the gatekeeper middleware, and can only be set using a direct clientto the account nodes. It accepts a float value and will only limit requests ifthe value is > 0.

Black/White-listing

To blacklist or whitelistan account set:

X-Account-Sysmeta-Global-Write-Ratelimit:BLACKLIST

or

X-Account-Sysmeta-Global-Write-Ratelimit:WHITELIST

in the account headers.

 

0 0
原创粉丝点击