Total time spent on GW networking is a top concern recently.
Our SDK is using HTTP 1.1 and TLS 1.2, while the latest available are HTTP 2 and TLS 1.3. I conducted the below timing analysis to see where we would benefit from updating to the latest versions of these protocols.
Local Testing
I used this script to execute a cURL request 100 times and collect the average total time.
I used the following URL: https://api.braintreegateway.com/heartbeat.json
TLS Version
HTTP Version
Avg Time (seconds)
TLS 1.2
HTTP 1.1
0.22898
TLS 1.3
HTTP 1.1
0.02098
TLS 1.2
HTTP 2
0.23487
TLS 1.3
HTTP 2
0.01953
Takeaways
The improvement from TLS 1.2 --> 1.3 across both HTTP is significant, averaging 211.5 ms faster 🎉🎉.
The savings from HTTP 1.1 --> HTTP 2 are less significant (0.145 ms), and seem to be coupled with using TLS 1.3.
Note: Android's HTTPURLConnection library, which we use for networking, only supports up to HTTP 1.1. So, if we did want to move to HTTP 2 at some point, we would probably have to migrate to OkHttp, which supports HTTP 2. Based on these timing results, it doesn't seem to be worth it at this time.
Background
Total time spent on GW networking is a top concern recently.
Our SDK is using HTTP 1.1 and TLS 1.2, while the latest available are HTTP 2 and TLS 1.3. I conducted the below timing analysis to see where we would benefit from updating to the latest versions of these protocols.
Local Testing
I used this script to execute a cURL request 100 times and collect the average total time.
I used the following URL:
https://api.braintreegateway.com/heartbeat.json
Takeaways
HTTPURLConnection
library, which we use for networking, only supports up to HTTP 1.1. So, if we did want to move to HTTP 2 at some point, we would probably have to migrate to OkHttp, which supports HTTP 2. Based on these timing results, it doesn't seem to be worth it at this time.Checklist
Authors
@scannillo