Home > Net >  Which TCP Congestion Control Algorighms are supported (and used) by OkHttp?
Which TCP Congestion Control Algorighms are supported (and used) by OkHttp?

Time:08-07

What is the list of all TCP Congestion Control Algorithms that are utilized by the OkHttp library?

I'm trying to figure out why some FOSS mobile apps fail so miserably in poor network conditions (high packet loss, jitter, latency). But sometimes the devs just wave their hands and say it should be fine because they're using OkHttp.

While it does appear that OKHttp is designed to minimize bandwidth with caching and do other cool things that translate to better UX, I couldn't find any information in the OkHttp documentation that specified which TCP Congestion Control Algorithms they're using.

For example, how can I tell OkHttp to use BBR?

CodePudding user response:

TCP behavior including congestion control is fully handled by the OS and the most an application can do is select from the algorithms the OS offers. Most applications don't select anything here but rely on OS defaults. And as far as I can see from the source code OkHttp is no different here, i.e. it simply relies on the OS default.

CodePudding user response:

I don't think OkHttp can answer this definitively since we just use the JVM networking libraries. We also see very different behaviour on JVM (changing with major releases) and on different Android versions.

So it would be up to whatever the VM chooses.

It uses SocketFactory.getDefault() here https://github.com/square/okhttp/blob/b515117984e198fd710e85005ee7a520e236e3f3/okhttp/src/jvmMain/kotlin/okhttp3/OkHttpClient.kt#L525

And then connects here

https://github.com/square/okhttp/blob/fd6452596c9f8c691b7864e212faf03d7c3bf8d8/okhttp/src/jvmMain/kotlin/okhttp3/internal/connection/ConnectPlan.kt#L241

  • Related