grpc / grpc-java

The Java gRPC implementation. HTTP/2 based RPC
https://grpc.io/docs/languages/java/
Apache License 2.0
11.36k stars 3.82k forks source link

Bandwidth-Delay Product algorithm for OkHttp? #8226

Open jmariller opened 3 years ago

jmariller commented 3 years ago

Hello,

I have seen that Netty has a BDP feature - any plans to implement the same for OkHttp?

Apologies if this is not the best place to ask.

Many thanks in advance for your support!

YifeiZhuang commented 3 years ago

What are the specific use cases for bandwidth-delay product (BDP) in okhttp?

We only enabled the BDP-monitoring logic in netty channel a short while ago that that will increase the window if appropriate.

For now In okhttp you could use manually flow control using OkHttpChannelBuilder.flowControlWindow() setting.

jmariller commented 3 years ago

Thank you @YifeiZhuang for the quick feedback!

What are the specific use cases for bandwidth-delay product (BDP) in okhttp?

We are developing an Android application using gRPC, and this app will run on different types of devices (smartphones, screens, smart glasses, etc.) - during our initial tests we noticed that, on some devices - especially the older smart glasses - the data transfer performance could be increased by setting flowControlWindow as you mentioned. However we would prefer to avoid having to set manual flow control, considering that the value may have to be dynamically adjusted per device.

ejona86 commented 3 years ago

How much did you need to increase flowControlWindow before you started seeing diminishing returns? Just like 128 KB, or something much higher?

The communication with the older smart glasses, is that going over the Internet to a remote server? Or are you doing some sort of local communication?

jmariller commented 3 years ago

Thanks for getting back to me @ejona86!

How much did you need to increase flowControlWindow before you started seeing diminishing returns? Just like 128 KB, or something much higher?

It rather started at around 512 KB and became even more noticeable at 1 MB

The communication with the older smart glasses, is that going over the Internet to a remote server? Or are you doing some sort of local communication?

The communication is going via local communication (e.g. WiFi)

ejona86 commented 3 years ago

It rather started at around 512 KB and became even more noticeable at 1 MB

The diminishing returns started around 512 KB?

The communication is going via local communication (e.g. WiFi)

Both devices are in the same wifi network though, right?

I can believe that grpc-okhttp could benefit from BDP in some cases. But we probably also want it to be more conservative with its use of PING than grpc-netty for power usage reasons. I'm not sure when we'll get to this.

jmariller commented 3 years ago

The diminishing returns started around 512 KB?

Yes

Both devices are in the same wifi network though, right?

Yes

I can believe that grpc-okhttp could benefit from BDP in some cases. But we probably also want it to be more conservative with its use of PING than grpc-netty for power usage reasons. I'm not sure when we'll get to this.

I understand. In the meantime we are using Netty on Android device, which seem to be working fine