Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BDP estimation and window update. #1310

Merged
merged 13 commits into from
Jul 11, 2017
Merged

BDP estimation and window update. #1310

merged 13 commits into from
Jul 11, 2017

Conversation

MakMukhi
Copy link
Contributor

@MakMukhi MakMukhi commented Jun 15, 2017

#1280
This is the first iteration for BDP estimation based on the algorithm proposed by @ejona86.
With this we get significant performance boost on high latency networks with varied message sizes.

Following are some benchmark results:

Cross-continental network (RTT: ~152ms)
Benchmark scenario:

  • Same as originally proposed by @adg
  • Client makes an RPC with a payload, server responds back with an empty message.
  • Time taken for each RPC is measured.
  • 50 such RPCs were made.

Unmerged benchmark code

Message Size GRPC HTTP 1.1
1 KB ~152 ms ~152 ms
10 KB ~152 ms ~152 ms
100 KB ~152 ms ~152 ms
1 MB ~156 ms ~156 ms
10 MB ~622 ms ~630ms
100 MB ~5 sec ~5 sec

The same benchmark was run locally for different latency values. Latency was simulated using @dfawley 's implementation.
Following are the results:

Duration	Latency	Proto

6.600167ms	0s	GRPC
5.92986ms	0s	GRPC
6.270963ms	0s	GRPC
7.631761ms	0s	GRPC
5.963633ms	0s	GRPC
7.651049ms	0s	GRPC
5.380809ms	0s	GRPC
7.794026ms	0s	GRPC
6.137369ms	0s	GRPC
9.351271ms	0s	GRPC
5.427743ms	0s	GRPC
6.515374ms	0s	GRPC
8.919418ms	0s	GRPC
5.29958ms	0s	GRPC
5.203105ms	0s	GRPC
5.463521ms	0s	GRPC
6.223441ms	0s	GRPC
5.876505ms	0s	GRPC
5.459718ms	0s	GRPC
6.409007ms	0s	GRPC

19.334748ms	0s	HTTP/2.0
12.482097ms	0s	HTTP/2.0
10.337082ms	0s	HTTP/2.0
12.866203ms	0s	HTTP/2.0
9.752807ms	0s	HTTP/2.0
12.444878ms	0s	HTTP/2.0
13.912482ms	0s	HTTP/2.0
14.607295ms	0s	HTTP/2.0
12.154512ms	0s	HTTP/2.0
17.754248ms	0s	HTTP/2.0
15.271548ms	0s	HTTP/2.0
13.292222ms	0s	HTTP/2.0
14.444244ms	0s	HTTP/2.0
14.035262ms	0s	HTTP/2.0
12.85932ms	0s	HTTP/2.0
10.444604ms	0s	HTTP/2.0
11.780001ms	0s	HTTP/2.0
14.121299ms	0s	HTTP/2.0
13.602992ms	0s	HTTP/2.0
13.880243ms	0s	HTTP/2.0

19.698488ms	0s	HTTP/1.1
9.318203ms	0s	HTTP/1.1
18.767328ms	0s	HTTP/1.1
14.813629ms	0s	HTTP/1.1
11.974776ms	0s	HTTP/1.1
8.16991ms	0s	HTTP/1.1
10.788239ms	0s	HTTP/1.1
7.245157ms	0s	HTTP/1.1
10.408003ms	0s	HTTP/1.1
15.445275ms	0s	HTTP/1.1
10.524208ms	0s	HTTP/1.1
14.720253ms	0s	HTTP/1.1
10.817449ms	0s	HTTP/1.1
9.20026ms	0s	HTTP/1.1
15.465905ms	0s	HTTP/1.1
10.631693ms	0s	HTTP/1.1
12.965184ms	0s	HTTP/1.1
13.336416ms	0s	HTTP/1.1
10.987415ms	0s	HTTP/1.1
13.739586ms	0s	HTTP/1.1

24.027115ms	1ms	GRPC
11.482191ms	1ms	GRPC
11.144368ms	1ms	GRPC
9.297564ms	1ms	GRPC
6.972486ms	1ms	GRPC
10.153392ms	1ms	GRPC
12.128864ms	1ms	GRPC
8.616666ms	1ms	GRPC
9.135017ms	1ms	GRPC
7.197465ms	1ms	GRPC
11.30004ms	1ms	GRPC
7.845656ms	1ms	GRPC
6.352299ms	1ms	GRPC
7.958337ms	1ms	GRPC
6.121027ms	1ms	GRPC
7.251149ms	1ms	GRPC
6.736074ms	1ms	GRPC
7.264468ms	1ms	GRPC
9.027332ms	1ms	GRPC
7.312215ms	1ms	GRPC

97.282785ms	1ms	HTTP/2.0
85.101225ms	1ms	HTTP/2.0
81.679364ms	1ms	HTTP/2.0
84.189977ms	1ms	HTTP/2.0
80.846348ms	1ms	HTTP/2.0
84.272778ms	1ms	HTTP/2.0
82.109176ms	1ms	HTTP/2.0
84.185242ms	1ms	HTTP/2.0
83.983272ms	1ms	HTTP/2.0
79.089912ms	1ms	HTTP/2.0
84.562781ms	1ms	HTTP/2.0
81.11639ms	1ms	HTTP/2.0
81.31943ms	1ms	HTTP/2.0
81.609473ms	1ms	HTTP/2.0
82.470331ms	1ms	HTTP/2.0
84.511823ms	1ms	HTTP/2.0
81.868979ms	1ms	HTTP/2.0
80.184406ms	1ms	HTTP/2.0
80.570062ms	1ms	HTTP/2.0
79.071575ms	1ms	HTTP/2.0

18.116236ms	1ms	HTTP/1.1
7.781637ms	1ms	HTTP/1.1
12.147163ms	1ms	HTTP/1.1
11.737004ms	1ms	HTTP/1.1
6.729138ms	1ms	HTTP/1.1
8.220292ms	1ms	HTTP/1.1
7.892468ms	1ms	HTTP/1.1
8.037918ms	1ms	HTTP/1.1
8.249543ms	1ms	HTTP/1.1
7.839087ms	1ms	HTTP/1.1
7.424441ms	1ms	HTTP/1.1
11.605572ms	1ms	HTTP/1.1
8.790402ms	1ms	HTTP/1.1
9.893814ms	1ms	HTTP/1.1
9.558892ms	1ms	HTTP/1.1
9.697752ms	1ms	HTTP/1.1
10.686002ms	1ms	HTTP/1.1
14.945215ms	1ms	HTTP/1.1
10.892475ms	1ms	HTTP/1.1
10.33792ms	1ms	HTTP/1.1

46.093219ms	2ms	GRPC
13.413606ms	2ms	GRPC
14.333648ms	2ms	GRPC
11.444652ms	2ms	GRPC
11.133175ms	2ms	GRPC
9.906453ms	2ms	GRPC
8.849316ms	2ms	GRPC
11.269747ms	2ms	GRPC
10.147314ms	2ms	GRPC
10.286274ms	2ms	GRPC
9.567101ms	2ms	GRPC
13.786333ms	2ms	GRPC
9.3183ms	2ms	GRPC
9.422859ms	2ms	GRPC
11.408894ms	2ms	GRPC
8.927899ms	2ms	GRPC
9.087681ms	2ms	GRPC
10.170031ms	2ms	GRPC
9.368516ms	2ms	GRPC
10.13453ms	2ms	GRPC

158.484003ms	2ms	HTTP/2.0
147.901022ms	2ms	HTTP/2.0
149.299792ms	2ms	HTTP/2.0
153.69499ms	2ms	HTTP/2.0
151.106112ms	2ms	HTTP/2.0
152.046706ms	2ms	HTTP/2.0
152.100044ms	2ms	HTTP/2.0
154.145211ms	2ms	HTTP/2.0
153.286022ms	2ms	HTTP/2.0
150.890895ms	2ms	HTTP/2.0
149.645544ms	2ms	HTTP/2.0
151.434275ms	2ms	HTTP/2.0
150.196131ms	2ms	HTTP/2.0
150.626736ms	2ms	HTTP/2.0
152.2373ms	2ms	HTTP/2.0
149.68984ms	2ms	HTTP/2.0
149.752499ms	2ms	HTTP/2.0
150.796386ms	2ms	HTTP/2.0
151.477512ms	2ms	HTTP/2.0
150.775809ms	2ms	HTTP/2.0

35.609578ms	2ms	HTTP/1.1
13.827407ms	2ms	HTTP/1.1
14.102704ms	2ms	HTTP/1.1
13.370629ms	2ms	HTTP/1.1
16.578144ms	2ms	HTTP/1.1
13.961669ms	2ms	HTTP/1.1
14.456718ms	2ms	HTTP/1.1
14.396199ms	2ms	HTTP/1.1
12.993359ms	2ms	HTTP/1.1
12.924333ms	2ms	HTTP/1.1
11.954644ms	2ms	HTTP/1.1
10.800344ms	2ms	HTTP/1.1
14.250179ms	2ms	HTTP/1.1
15.301845ms	2ms	HTTP/1.1
14.182832ms	2ms	HTTP/1.1
11.59359ms	2ms	HTTP/1.1
10.833893ms	2ms	HTTP/1.1
14.14158ms	2ms	HTTP/1.1
14.649289ms	2ms	HTTP/1.1
15.593844ms	2ms	HTTP/1.1

88.476852ms	4ms	GRPC
28.297448ms	4ms	GRPC
20.82513ms	4ms	GRPC
16.106743ms	4ms	GRPC
14.857404ms	4ms	GRPC
13.885277ms	4ms	GRPC
13.252429ms	4ms	GRPC
13.234379ms	4ms	GRPC
14.867543ms	4ms	GRPC
12.479987ms	4ms	GRPC
18.121659ms	4ms	GRPC
11.673649ms	4ms	GRPC
14.76684ms	4ms	GRPC
14.802251ms	4ms	GRPC
13.241416ms	4ms	GRPC
12.111612ms	4ms	GRPC
13.565331ms	4ms	GRPC
11.633773ms	4ms	GRPC
11.529235ms	4ms	GRPC
12.962252ms	4ms	GRPC

302.44079ms	4ms	HTTP/2.0
284.998472ms	4ms	HTTP/2.0
280.292955ms	4ms	HTTP/2.0
283.89673ms	4ms	HTTP/2.0
284.456311ms	4ms	HTTP/2.0
284.324431ms	4ms	HTTP/2.0
284.619648ms	4ms	HTTP/2.0
282.744421ms	4ms	HTTP/2.0
283.647762ms	4ms	HTTP/2.0
278.399437ms	4ms	HTTP/2.0
284.109677ms	4ms	HTTP/2.0
282.993304ms	4ms	HTTP/2.0
284.664826ms	4ms	HTTP/2.0
284.215417ms	4ms	HTTP/2.0
284.609986ms	4ms	HTTP/2.0
283.006819ms	4ms	HTTP/2.0
284.588571ms	4ms	HTTP/2.0
284.885846ms	4ms	HTTP/2.0
284.22554ms	4ms	HTTP/2.0
285.51002ms	4ms	HTTP/2.0

47.783592ms	4ms	HTTP/1.1
18.757966ms	4ms	HTTP/1.1
16.125478ms	4ms	HTTP/1.1
18.502415ms	4ms	HTTP/1.1
17.965312ms	4ms	HTTP/1.1
18.241917ms	4ms	HTTP/1.1
15.200867ms	4ms	HTTP/1.1
13.131059ms	4ms	HTTP/1.1
13.994779ms	4ms	HTTP/1.1
15.922708ms	4ms	HTTP/1.1
17.076952ms	4ms	HTTP/1.1
17.446873ms	4ms	HTTP/1.1
18.94432ms	4ms	HTTP/1.1
18.872469ms	4ms	HTTP/1.1
17.519663ms	4ms	HTTP/1.1
13.803188ms	4ms	HTTP/1.1
18.164946ms	4ms	HTTP/1.1
18.949584ms	4ms	HTTP/1.1
22.103356ms	4ms	HTTP/1.1
17.972514ms	4ms	HTTP/1.1

151.469543ms	8ms	GRPC
38.460864ms	8ms	GRPC
36.915278ms	8ms	GRPC
23.463889ms	8ms	GRPC
20.464079ms	8ms	GRPC
23.276851ms	8ms	GRPC
23.780799ms	8ms	GRPC
19.460499ms	8ms	GRPC
25.281778ms	8ms	GRPC
19.634298ms	8ms	GRPC
23.40014ms	8ms	GRPC
21.861284ms	8ms	GRPC
20.061729ms	8ms	GRPC
27.499666ms	8ms	GRPC
21.482204ms	8ms	GRPC
21.461408ms	8ms	GRPC
21.668897ms	8ms	GRPC
21.960101ms	8ms	GRPC
22.028669ms	8ms	GRPC
21.697308ms	8ms	GRPC

583.748435ms	8ms	HTTP/2.0
549.023971ms	8ms	HTTP/2.0
549.375051ms	8ms	HTTP/2.0
542.387801ms	8ms	HTTP/2.0
545.7286ms	8ms	HTTP/2.0
547.957666ms	8ms	HTTP/2.0
549.548751ms	8ms	HTTP/2.0
548.930256ms	8ms	HTTP/2.0
549.978658ms	8ms	HTTP/2.0
549.764562ms	8ms	HTTP/2.0
549.984164ms	8ms	HTTP/2.0
547.975116ms	8ms	HTTP/2.0
547.467303ms	8ms	HTTP/2.0
548.790175ms	8ms	HTTP/2.0
550.078936ms	8ms	HTTP/2.0
549.21887ms	8ms	HTTP/2.0
549.676758ms	8ms	HTTP/2.0
549.38113ms	8ms	HTTP/2.0
549.638525ms	8ms	HTTP/2.0
548.546452ms	8ms	HTTP/2.0

72.379257ms	8ms	HTTP/1.1
28.321527ms	8ms	HTTP/1.1
24.429667ms	8ms	HTTP/1.1
26.671663ms	8ms	HTTP/1.1
25.911429ms	8ms	HTTP/1.1
24.591754ms	8ms	HTTP/1.1
25.802092ms	8ms	HTTP/1.1
25.861829ms	8ms	HTTP/1.1
23.48202ms	8ms	HTTP/1.1
24.609806ms	8ms	HTTP/1.1
25.709351ms	8ms	HTTP/1.1
26.390812ms	8ms	HTTP/1.1
25.562732ms	8ms	HTTP/1.1
26.15708ms	8ms	HTTP/1.1
24.966165ms	8ms	HTTP/1.1
25.048506ms	8ms	HTTP/1.1
25.801727ms	8ms	HTTP/1.1
29.176496ms	8ms	HTTP/1.1
23.769895ms	8ms	HTTP/1.1
23.68525ms	8ms	HTTP/1.1

265.454856ms	16ms	GRPC
102.102205ms	16ms	GRPC
69.615943ms	16ms	GRPC
39.086695ms	16ms	GRPC
38.821149ms	16ms	GRPC
39.236963ms	16ms	GRPC
41.434245ms	16ms	GRPC
37.382596ms	16ms	GRPC
41.640625ms	16ms	GRPC
37.274439ms	16ms	GRPC
40.216846ms	16ms	GRPC
38.155703ms	16ms	GRPC
37.458147ms	16ms	GRPC
40.053354ms	16ms	GRPC
36.776424ms	16ms	GRPC
39.378733ms	16ms	GRPC
39.266613ms	16ms	GRPC
38.118462ms	16ms	GRPC
36.059983ms	16ms	GRPC
38.547521ms	16ms	GRPC

1.154009359s	16ms	HTTP/2.0
1.079562529s	16ms	HTTP/2.0
1.078049317s	16ms	HTTP/2.0
1.078157366s	16ms	HTTP/2.0
1.077615605s	16ms	HTTP/2.0
1.078158442s	16ms	HTTP/2.0
1.078518507s	16ms	HTTP/2.0
1.077750957s	16ms	HTTP/2.0
1.078114479s	16ms	HTTP/2.0
1.078746465s	16ms	HTTP/2.0
1.076840309s	16ms	HTTP/2.0
1.071528795s	16ms	HTTP/2.0
1.070716242s	16ms	HTTP/2.0
1.070907562s	16ms	HTTP/2.0
1.082941831s	16ms	HTTP/2.0
1.07925617s	16ms	HTTP/2.0
1.079373801s	16ms	HTTP/2.0
1.074137983s	16ms	HTTP/2.0
1.073057922s	16ms	HTTP/2.0
1.074642846s	16ms	HTTP/2.0

122.806058ms	16ms	HTTP/1.1
40.440683ms	16ms	HTTP/1.1
42.922436ms	16ms	HTTP/1.1
40.651451ms	16ms	HTTP/1.1
37.010707ms	16ms	HTTP/1.1
40.254532ms	16ms	HTTP/1.1
40.584851ms	16ms	HTTP/1.1
45.626552ms	16ms	HTTP/1.1
52.616933ms	16ms	HTTP/1.1
40.86642ms	16ms	HTTP/1.1
43.078638ms	16ms	HTTP/1.1
40.303898ms	16ms	HTTP/1.1
61.267662ms	16ms	HTTP/1.1
48.811317ms	16ms	HTTP/1.1
37.484503ms	16ms	HTTP/1.1
36.749465ms	16ms	HTTP/1.1
37.540018ms	16ms	HTTP/1.1
36.905652ms	16ms	HTTP/1.1
36.932516ms	16ms	HTTP/1.1
37.574724ms	16ms	HTTP/1.1

582.681765ms	32ms	GRPC
196.57267ms	32ms	GRPC
130.547044ms	32ms	GRPC
68.572973ms	32ms	GRPC
69.335906ms	32ms	GRPC
73.773554ms	32ms	GRPC
71.118832ms	32ms	GRPC
71.073048ms	32ms	GRPC
69.393561ms	32ms	GRPC
70.064762ms	32ms	GRPC
68.792951ms	32ms	GRPC
73.691751ms	32ms	GRPC
68.983865ms	32ms	GRPC
69.705746ms	32ms	GRPC
70.948599ms	32ms	GRPC
69.949506ms	32ms	GRPC
68.530502ms	32ms	GRPC
73.426576ms	32ms	GRPC
68.476093ms	32ms	GRPC
68.591578ms	32ms	GRPC

2.266128908s	32ms	HTTP/2.0
2.13549067s	32ms	HTTP/2.0
2.134966823s	32ms	HTTP/2.0
2.134634124s	32ms	HTTP/2.0
2.134862908s	32ms	HTTP/2.0
2.134780172s	32ms	HTTP/2.0
2.133535192s	32ms	HTTP/2.0
2.134187651s	32ms	HTTP/2.0
2.134330895s	32ms	HTTP/2.0
2.134013872s	32ms	HTTP/2.0
2.134708718s	32ms	HTTP/2.0
2.134600269s	32ms	HTTP/2.0
2.134471584s	32ms	HTTP/2.0
2.133680121s	32ms	HTTP/2.0
2.134224243s	32ms	HTTP/2.0
2.134420337s	32ms	HTTP/2.0
2.134690307s	32ms	HTTP/2.0
2.135141339s	32ms	HTTP/2.0
2.13424198s	32ms	HTTP/2.0
2.133135366s	32ms	HTTP/2.0

215.405563ms	32ms	HTTP/1.1
75.324911ms	32ms	HTTP/1.1
74.070659ms	32ms	HTTP/1.1
72.828183ms	32ms	HTTP/1.1
74.300112ms	32ms	HTTP/1.1
75.146888ms	32ms	HTTP/1.1
74.212878ms	32ms	HTTP/1.1
74.793902ms	32ms	HTTP/1.1
72.249214ms	32ms	HTTP/1.1
73.133389ms	32ms	HTTP/1.1
73.813364ms	32ms	HTTP/1.1
75.261679ms	32ms	HTTP/1.1
75.34133ms	32ms	HTTP/1.1
75.449125ms	32ms	HTTP/1.1
74.709143ms	32ms	HTTP/1.1
75.165918ms	32ms	HTTP/1.1
75.008413ms	32ms	HTTP/1.1
75.577536ms	32ms	HTTP/1.1
74.45506ms	32ms	HTTP/1.1
75.568994ms	32ms	HTTP/1.1

1.37872914s	76ms	GRPC
463.049814ms	76ms	GRPC
309.98315ms	76ms	GRPC
308.218324ms	76ms	GRPC
159.551876ms	76ms	GRPC
159.576344ms	76ms	GRPC
159.047179ms	76ms	GRPC
159.226185ms	76ms	GRPC
161.195174ms	76ms	GRPC
157.822135ms	76ms	GRPC
158.481192ms	76ms	GRPC
159.273124ms	76ms	GRPC
158.803292ms	76ms	GRPC
166.064151ms	76ms	GRPC
158.725457ms	76ms	GRPC
157.384121ms	76ms	GRPC
161.339115ms	76ms	GRPC
162.853389ms	76ms	GRPC
158.150154ms	76ms	GRPC
157.699727ms	76ms	GRPC

5.348294082s	76ms	HTTP/2.0
5.039557296s	76ms	HTTP/2.0
5.040344214s	76ms	HTTP/2.0
5.039287621s	76ms	HTTP/2.0
5.038867784s	76ms	HTTP/2.0
5.039227597s	76ms	HTTP/2.0
5.039831761s	76ms	HTTP/2.0
5.040296293s	76ms	HTTP/2.0
5.038502682s	76ms	HTTP/2.0
5.038471939s	76ms	HTTP/2.0
5.039124154s	76ms	HTTP/2.0
5.039976913s	76ms	HTTP/2.0
5.037594315s	76ms	HTTP/2.0
5.039745875s	76ms	HTTP/2.0
5.039393306s	76ms	HTTP/2.0
5.039727847s	76ms	HTTP/2.0
5.039473051s	76ms	HTTP/2.0
5.039460714s	76ms	HTTP/2.0
5.038708533s	76ms	HTTP/2.0
5.039852533s	76ms	HTTP/2.0

490.623997ms	76ms	HTTP/1.1
166.966323ms	76ms	HTTP/1.1
164.816783ms	76ms	HTTP/1.1
161.322522ms	76ms	HTTP/1.1
162.281079ms	76ms	HTTP/1.1
160.227523ms	76ms	HTTP/1.1
163.145007ms	76ms	HTTP/1.1
163.473591ms	76ms	HTTP/1.1
162.818667ms	76ms	HTTP/1.1
161.859666ms	76ms	HTTP/1.1
161.721434ms	76ms	HTTP/1.1
162.605561ms	76ms	HTTP/1.1
162.952727ms	76ms	HTTP/1.1
161.129836ms	76ms	HTTP/1.1
159.421255ms	76ms	HTTP/1.1
160.407747ms	76ms	HTTP/1.1
160.425066ms	76ms	HTTP/1.1
159.711554ms	76ms	HTTP/1.1
159.836805ms	76ms	HTTP/1.1
157.521415ms	76ms	HTTP/1.1

MakMukhi added 9 commits May 26, 2017 08:08

Verified

This commit was signed with the committer’s verified signature.
alexeagle Alex Eagle

Verified

This commit was signed with the committer’s verified signature.
alexeagle Alex Eagle

Verified

This commit was signed with the committer’s verified signature.
alexeagle Alex Eagle

Verified

This commit was signed with the committer’s verified signature.
alexeagle Alex Eagle

Verified

This commit was signed with the committer’s verified signature.
alexeagle Alex Eagle

Verified

This commit was signed with the committer’s verified signature.
alexeagle Alex Eagle

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@MakMukhi MakMukhi requested review from menghanl, dfawley and apolcyn June 15, 2017 00:18
)

var (
bdpPing = &ping{data: [8]byte{1, 2, 3, 4, 5, 6, 7, 8}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Half-serious comment:

How about:
2,4,16,16,9,14,7,7 ?
98,100,112,80,105,110,103,33 ?
103,82,80,67,45,103,111,0 ?


const (
limit = (1 << 20) * 4
alpha = 0.9
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Almost completely opaque"? :)

Please document these constants.

)

type bdpEstimator struct {
side string
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this only for debugging? Maybe remove it to avoid the extra memory...


mu sync.Mutex
bdp uint32
sample uint32 // Current bdp sample.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doc the units, please. Maybe:

// Bytes received during this sample. ?

bdp uint32
sample uint32 // Current bdp sample.
sentAt time.Time // Time when the ping was sent.
bwMax float64
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Units?

if opts.InitialConnWindowSize >= defaultWindowSize {
icwz = opts.InitialConnWindowSize
dynamicWindow = false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this not be false?

If I see an option called "Initial ______", I don't assume that will disable dynamic updates to ____. Ideally there should be a different option to set to prevent BDP calculation from affecting the window sizes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some follow-up work needed for this.

)

const (
limit = (1 << 20) * 4
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: prefix consts with "bdp" to avoid name collisions.

if dynamicWindow {
t.bdpEst = &bdpEstimator{
bdp: initialWindowSize,
updateFlowControl: func(n uint32) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a method to http2Client to do this instead of inlining it, please? So this would be:

    updateFlowControl: t.updateFlowControl

if sendBDPPing {
t.controlBuf.put(&windowUpdate{0, uint32(size), false})
t.controlBuf.put(bdpPing)
} else {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it not a problem to skip the onData/onRead calls into the flow control?

For a later discussion, not this PR: should the flow control be aware of the BDP estimator?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved after offline discussion

@@ -927,6 +968,10 @@ func (t *http2Client) handleSettings(f *http2.SettingsFrame) {

func (t *http2Client) handlePing(f *http2.PingFrame) {
if f.IsAck() { // Do nothing.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No longer "do nothing"...

Copy link
Member

@dfawley dfawley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just a couple of nits.

@@ -89,13 +106,14 @@ func (b *bdpEstimator) calculate(d [8]byte) {
// If the current sample (which is smaller than or equal to the 1.5 times the real BDP) is
// greater than or equal to 2/3rd our perceived bdp AND this is the maximum bandwidth seen so far, we
// should update our perception of the network BDP.
if float64(b.sample) >= float64(0.66)*float64(b.bdp) && bwCurrent == b.bwMax {
if float64(b.sample) >= float64(beta)*float64(b.bdp) && bwCurrent == b.bwMax && b.bdp != bdpLimit {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

beta shouldn't need a cast.

@@ -89,13 +106,14 @@ func (b *bdpEstimator) calculate(d [8]byte) {
// If the current sample (which is smaller than or equal to the 1.5 times the real BDP) is
// greater than or equal to 2/3rd our perceived bdp AND this is the maximum bandwidth seen so far, we
// should update our perception of the network BDP.
if float64(b.sample) >= float64(0.66)*float64(b.bdp) && bwCurrent == b.bwMax {
if float64(b.sample) >= float64(beta)*float64(b.bdp) && bwCurrent == b.bwMax && b.bdp != bdpLimit {
// Put our bdp to be smaller than or equal to twice the real BDP.
// We really should multiply with 4/3, however to round things out
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this comment to where gamma is defined. Maybe add something like:

"If gamma were 4/3, we would set our new BDP estimate to double the measured BDP".

Alternatively, express gamma as that scaling factor and have another const of 1.5 for the 1.5 round trips covered by the sample. Or even gamma = 3/1.5?

@MakMukhi MakMukhi merged commit d69dedd into grpc:master Jul 11, 2017
@menghanl menghanl added 1.5 Type: Performance Performance improvements (CPU, network, memory, etc) labels Jul 11, 2017
@MakMukhi MakMukhi deleted the bdp branch May 4, 2018 02:00
@lock lock bot locked as resolved and limited conversation to collaborators Jan 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Type: Performance Performance improvements (CPU, network, memory, etc)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants