Merge "Added config options for rate limiting of large object downloads."
This commit is contained in:
commit
cc73f5cbe0
@ -470,6 +470,11 @@ container sync won't be able to sync posts. The default is True.
|
|||||||
.IP \fBaccount_autocreate\fR
|
.IP \fBaccount_autocreate\fR
|
||||||
If set to 'true' authorized accounts that do not yet exist within the Swift cluster
|
If set to 'true' authorized accounts that do not yet exist within the Swift cluster
|
||||||
will be automatically created. The default is set to false.
|
will be automatically created. The default is set to false.
|
||||||
|
.IP \fBrate_limit_after_segment\fR
|
||||||
|
Rate limit the download of large object segments after this segment is
|
||||||
|
downloaded. The default is 10 segments.
|
||||||
|
.IP \fBrate_limit_segments_per_sec\fR
|
||||||
|
Rate limit large object downlods at this rate. The default is 1.
|
||||||
.RE
|
.RE
|
||||||
.PD
|
.PD
|
||||||
|
|
||||||
|
@ -592,6 +592,11 @@ max_containers_whitelist This is a comma separated list
|
|||||||
of account hashes that ignore
|
of account hashes that ignore
|
||||||
the max_containers_per_account
|
the max_containers_per_account
|
||||||
cap.
|
cap.
|
||||||
|
rate_limit_after_segment 10 Rate limit the download of
|
||||||
|
large object segments after
|
||||||
|
this segment is downloaded.
|
||||||
|
rate_limit_segments_per_sec 1 Rate limit large object
|
||||||
|
downloads at this rate.
|
||||||
============================ =============== =============================
|
============================ =============== =============================
|
||||||
|
|
||||||
[tempauth]
|
[tempauth]
|
||||||
|
@ -163,9 +163,10 @@ class SegmentedIterable(object):
|
|||||||
if self.seek:
|
if self.seek:
|
||||||
req.range = 'bytes=%s-' % self.seek
|
req.range = 'bytes=%s-' % self.seek
|
||||||
self.seek = 0
|
self.seek = 0
|
||||||
if self.segment > 10:
|
if self.segment > self.controller.app.rate_limit_after_segment:
|
||||||
sleep(max(self.next_get_time - time.time(), 0))
|
sleep(max(self.next_get_time - time.time(), 0))
|
||||||
self.next_get_time = time.time() + 1
|
self.next_get_time = time.time() + \
|
||||||
|
1.0 / self.controller.app.rate_limit_segments_per_sec
|
||||||
shuffle(nodes)
|
shuffle(nodes)
|
||||||
resp = self.controller.GETorHEAD_base(req, _('Object'), partition,
|
resp = self.controller.GETorHEAD_base(req, _('Object'), partition,
|
||||||
self.controller.iter_nodes(partition, nodes,
|
self.controller.iter_nodes(partition, nodes,
|
||||||
@ -1917,6 +1918,10 @@ class BaseApplication(object):
|
|||||||
if a.strip()]
|
if a.strip()]
|
||||||
self.deny_host_headers = [host.strip() for host in
|
self.deny_host_headers = [host.strip() for host in
|
||||||
conf.get('deny_host_headers', '').split(',') if host.strip()]
|
conf.get('deny_host_headers', '').split(',') if host.strip()]
|
||||||
|
self.rate_limit_after_segment = \
|
||||||
|
int(conf.get('rate_limit_after_segment', 10))
|
||||||
|
self.rate_limit_segments_per_sec = \
|
||||||
|
int(conf.get('rate_limit_segments_per_sec', 1))
|
||||||
|
|
||||||
def get_controller(self, path):
|
def get_controller(self, path):
|
||||||
"""
|
"""
|
||||||
|
@ -3888,6 +3888,8 @@ class FakeObjectController(object):
|
|||||||
self.trans_id = 'tx1'
|
self.trans_id = 'tx1'
|
||||||
self.object_ring = FakeRing()
|
self.object_ring = FakeRing()
|
||||||
self.node_timeout = 1
|
self.node_timeout = 1
|
||||||
|
self.rate_limit_after_segment = 10
|
||||||
|
self.rate_limit_segments_per_sec = 1
|
||||||
|
|
||||||
def exception(self, *args):
|
def exception(self, *args):
|
||||||
self.exception_args = args
|
self.exception_args = args
|
||||||
|
Loading…
x
Reference in New Issue
Block a user