[英]Which TCP Congestion Control Algorighms are supported (and used) by OkHttp?
What is the list of all TCP Congestion Control Algorithms that are utilized by the OkHttp library ? OkHttp 库使用的所有 TCP 拥塞控制算法的列表是什么?
I'm trying to figure out why some FOSS mobile apps fail so miserably in poor network conditions (high packet loss, jitter, latency).我试图弄清楚为什么一些 FOSS 移动应用程序在糟糕的网络条件下(高丢包率、抖动、延迟)会如此悲惨地失败。 But sometimes the devs just wave their hands and say it should be fine because they're using OkHttp.
但有时开发人员只是挥手说应该没问题,因为他们使用的是 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 whichTCP Congestion Control Algorithms they're using.虽然看起来 OKHttp 旨在通过缓存最小化带宽并做其他很酷的事情来转化为更好的用户体验,但我在OkHttp 文档中找不到任何信息,说明他们正在使用哪种TCP 拥塞控制算法。
For example, how can I tell OkHttp to use BBR ?例如,我如何告诉 OkHttp 使用BBR ?
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 . TCP 行为(包括拥塞控制)完全由操作系统处理,应用程序最多可以做的是来自操作系统提供的算法的 select 。 Most applications don't select anything here but rely on OS defaults.
大多数应用程序在这里没有 select 任何东西,而是依赖于操作系统默认值。 And as far as I can see from the source code OkHttp is no different here, ie it simply relies on the OS default.
从源代码中我可以看出 OkHttp 在这里没有什么不同,即它只是依赖于操作系统默认值。
I don't think OkHttp can answer this definitively since we just use the JVM networking libraries.我不认为 OkHttp 可以明确回答这个问题,因为我们只使用 JVM 网络库。 We also see very different behaviour on JVM (changing with major releases) and on different Android versions.
我们还在 JVM(随主要版本更改)和不同的 Android 版本上看到了非常不同的行为。
So it would be up to whatever the VM chooses.因此,这取决于 VM 的选择。
It uses SocketFactory.getDefault()
here https://github.com/square/okhttp/blob/b515117984e198fd710e85005ee7a520e236e3f3/okhttp/src/jvmMain/kotlin/okhttp3/OkHttpClient.kt#L525它在这里使用
SocketFactory.getDefault()
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 https://github.com/square/okhttp/blob/fd6452596c9f8c691b7864e212faf03d7c3bf8d8/okhttp/src/jvmMain/kotlin/okhttp3/internal/connection/ConnectPlan.kt#L241
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.