Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(97)

Issue 336560043: Adds bandwidth control to copy tasks (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
8 years, 5 months ago by joshuablome
Modified:
8 years, 2 months ago
Reviewers:
mbassiouny, thobrla, akaiser
CC:
opi-crs_google.com
Visibility:
Public.

Description

Adds bandwidth control to copy tasks

Patch Set 1 #

Total comments: 20

Patch Set 2 : Addressed first round of comments #

Patch Set 3 : Removed commented out line. #

Patch Set 4 : No longer checking bandwidth usage asynchronously #

Total comments: 7

Patch Set 5 : Added SLeep to mock clock and added a clock to CopyHandler #

Total comments: 3

Patch Set 6 : Changed Sleep parameter name to be consistent #

Total comments: 3

Patch Set 7 : Now using builtin rate.Limiter instead of manual rate limiting #

Total comments: 1

Patch Set 8 : Added error handling #

Total comments: 2

Patch Set 9 : Punctuation fix and removed unnecessary error check #

Unified diffs Side-by-side diffs Delta from patch set Stats (+19 lines, -1 line) Patch
M agent/copy.go View 1 2 3 4 5 6 7 8 3 chunks +17 lines, -0 lines 0 comments Download
M helpers/mock_clock.go View 1 2 3 4 5 6 1 chunk +2 lines, -1 line 0 comments Download

Messages

Total messages: 17
joshuablome
8 years, 5 months ago (2018-02-16 21:57:41 UTC) #1
thobrla
https://codereview.appspot.com/336560043/diff/1/agent/bandwidth_controller.go File agent/bandwidth_controller.go (right): https://codereview.appspot.com/336560043/diff/1/agent/bandwidth_controller.go#newcode24 agent/bandwidth_controller.go:24: type BandwidthController struct { Exported types and functions should ...
8 years, 5 months ago (2018-02-16 22:30:54 UTC) #2
akaiser
https://codereview.appspot.com/336560043/diff/1/agent/bandwidth_controller.go File agent/bandwidth_controller.go (right): https://codereview.appspot.com/336560043/diff/1/agent/bandwidth_controller.go#newcode30 agent/bandwidth_controller.go:30: desiredCopyTime := time.Duration(float64(bytesWritten) / float64(bc.bandwidth) * float64(time.Second)) On 2018/02/16 ...
8 years, 5 months ago (2018-02-16 23:56:10 UTC) #3
joshuablome
https://codereview.appspot.com/336560043/diff/1/agent/bandwidth_controller.go File agent/bandwidth_controller.go (right): https://codereview.appspot.com/336560043/diff/1/agent/bandwidth_controller.go#newcode24 agent/bandwidth_controller.go:24: type BandwidthController struct { On 2018/02/16 22:30:54, thobrla wrote: ...
8 years, 5 months ago (2018-02-20 22:31:08 UTC) #4
thobrla
More review to come later https://codereview.appspot.com/336560043/diff/1/agent/copy.go File agent/copy.go (right): https://codereview.appspot.com/336560043/diff/1/agent/copy.go#newcode155 agent/copy.go:155: go h.bwController.Start(&totalBytesWritten, &sleepDuration, time.Now()) ...
8 years, 5 months ago (2018-02-21 00:30:58 UTC) #5
joshuablome
https://codereview.appspot.com/336560043/diff/1/agent/copy.go File agent/copy.go (right): https://codereview.appspot.com/336560043/diff/1/agent/copy.go#newcode155 agent/copy.go:155: go h.bwController.Start(&totalBytesWritten, &sleepDuration, time.Now()) On 2018/02/21 00:30:58, thobrla wrote: ...
8 years, 5 months ago (2018-02-21 18:13:28 UTC) #6
thobrla
https://codereview.appspot.com/336560043/diff/1/agent/copy.go File agent/copy.go (right): https://codereview.appspot.com/336560043/diff/1/agent/copy.go#newcode153 agent/copy.go:153: time.Sleep(h.bwController.WaitTime(totalBytesWritten, time.Since(startTime))) Deferred functions' arguments are evaluated immediately: https://tour.golang.org/flowcontrol/12 ...
8 years, 5 months ago (2018-02-21 19:33:59 UTC) #7
joshuablome
https://codereview.appspot.com/336560043/diff/1/agent/copy.go File agent/copy.go (right): https://codereview.appspot.com/336560043/diff/1/agent/copy.go#newcode153 agent/copy.go:153: time.Sleep(h.bwController.WaitTime(totalBytesWritten, time.Since(startTime))) On 2018/02/21 19:33:59, thobrla wrote: > Deferred ...
8 years, 5 months ago (2018-02-21 23:55:47 UTC) #8
thobrla
LGTM https://codereview.appspot.com/336560043/diff/60001/agent/copy.go File agent/copy.go (right): https://codereview.appspot.com/336560043/diff/60001/agent/copy.go#newcode148 agent/copy.go:148: bandwidth = taskParams["bandwidth"].(int) On 2018/02/21 23:55:47, Josh B ...
8 years, 5 months ago (2018-02-22 01:40:02 UTC) #9
joshuablome
https://codereview.appspot.com/336560043/diff/80001/helpers/clock.go File helpers/clock.go (right): https://codereview.appspot.com/336560043/diff/80001/helpers/clock.go#newcode19 helpers/clock.go:19: func (realClock) Sleep(dur time.Duration) { On 2018/02/22 01:40:02, thobrla ...
8 years, 5 months ago (2018-02-23 18:02:04 UTC) #10
thobrla
https://codereview.appspot.com/336560043/diff/100001/agent/copy.go File agent/copy.go (right): https://codereview.appspot.com/336560043/diff/100001/agent/copy.go#newcode40 agent/copy.go:40: defaultBandwidthCap int = 16 * 1024 * 1024 // ...
8 years, 5 months ago (2018-02-23 18:05:06 UTC) #11
mbassiouny
Reply to view. On Fri, Feb 23, 2018 at 10:05 AM, <thobrla@google.com> wrote: > > ...
8 years, 5 months ago (2018-02-23 18:33:07 UTC) #12
mbassiouny
One Suggestion you may consider below. Thanks, Mahmoud https://codereview.appspot.com/336560043/diff/100001/agent/copy.go File agent/copy.go (right): https://codereview.appspot.com/336560043/diff/100001/agent/copy.go#newcode174 agent/copy.go:174: h.clock.Sleep(waitTime(bandwidth, ...
8 years, 5 months ago (2018-02-23 18:37:13 UTC) #13
joshuablome
https://codereview.appspot.com/336560043/diff/100001/agent/copy.go File agent/copy.go (right): https://codereview.appspot.com/336560043/diff/100001/agent/copy.go#newcode174 agent/copy.go:174: h.clock.Sleep(waitTime(bandwidth, totalBytesWritten, h.clock.Now().Sub(startTime))) On 2018/02/23 18:37:13, mbassiouny wrote: > ...
8 years, 5 months ago (2018-02-24 01:16:18 UTC) #14
thobrla
Still LGTM
8 years, 5 months ago (2018-02-24 01:30:32 UTC) #15
mbassiouny
Thanks Josh, LGTM with minor nit. Thanks, Mahmoud https://codereview.appspot.com/336560043/diff/120001/agent/copy.go File agent/copy.go (right): https://codereview.appspot.com/336560043/diff/120001/agent/copy.go#newcode153 agent/copy.go:153: limiter.WaitN(ctx, ...
8 years, 5 months ago (2018-02-26 20:45:02 UTC) #16
akaiser
8 years, 5 months ago (2018-02-27 18:01:28 UTC) #17
LGTM
2 nits

https://codereview.appspot.com/336560043/diff/140001/agent/copy.go
File agent/copy.go (right):

https://codereview.appspot.com/336560043/diff/140001/agent/copy.go#newcode152
agent/copy.go:152: // The rate limiter starts with a full token bucket, we need
to empty it before copying
copying.

Blah blah, punctuation. :)

https://codereview.appspot.com/336560043/diff/140001/agent/copy.go#newcode179
agent/copy.go:179: if err != nil {
Is this second "if err != nil" block necessary? It doesn't look like it to me.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b