Skip to content
This repository has been archived by the owner on Jul 25, 2024. It is now read-only.

Reuse TCP connection with LAVA labs that use REST API #1064

Open
chaws opened this issue Aug 2, 2022 · 0 comments
Open

Reuse TCP connection with LAVA labs that use REST API #1064

chaws opened this issue Aug 2, 2022 · 0 comments

Comments

@chaws
Copy link
Collaborator

chaws commented Aug 2, 2022

Can LAVA re-use TCP connection?

[2022-07-07 02:23:06 +0000] [DEBUG] tf.validation.linaro.org: Retrieving result summary for job: 866847
[2022-07-07 02:23:06 +0000] [DEBUG] Starting new HTTPS connection (1): tf.validation.linaro.org:443
[2022-07-07 02:23:07 +0000] [DEBUG] https://tf.validation.linaro.org:443 "POST //RPC2 HTTP/1.1" 200 197
[2022-07-07 02:23:07 +0000] [DEBUG] tf.validation.linaro.org: requesting results for 0_interactive_uart0_6 with offset of 0
[2022-07-07 02:23:07 +0000] [DEBUG] Starting new HTTPS connection (1): tf.validation.linaro.org:443
[2022-07-07 02:23:08 +0000] [DEBUG] https://tf.validation.linaro.org:443 "POST //RPC2 HTTP/1.1" 200 298
[2022-07-07 02:23:08 +0000] [DEBUG] tf.validation.linaro.org: requesting results for 0_interactive_uart0_5 with offset of 0
[2022-07-07 02:23:08 +0000] [DEBUG] Starting new HTTPS connection (1): tf.validation.linaro.org:443
[2022-07-07 02:23:09 +0000] [DEBUG] https://tf.validation.linaro.org:443 "POST //RPC2 HTTP/1.1" 200 299
[2022-07-07 02:23:09 +0000] [DEBUG] tf.validation.linaro.org: requesting results for 0_interactive_uart0_4 with offset of 0
[2022-07-07 02:23:09 +0000] [DEBUG] Starting new HTTPS connection (1): tf.validation.linaro.org:443
[2022-07-07 02:23:09 +0000] [DEBUG] https://tf.validation.linaro.org:443 "POST //RPC2 HTTP/1.1" 200 299
[2022-07-07 02:23:09 +0000] [DEBUG] tf.validation.linaro.org: requesting results for 0_interactive_uart0_3 with offset of 0

Problem

The interaction above took ~3s to complete, could it be improved by re-using the same connection?

Solution

Use sessions to connect to LAVA using REST API
Keep-Alive: timeout=5, max=100
s = requests.Session()
s.get("https://")
https://requests.readthedocs.io/en/latest/user/advanced/?highlight=keep%20alive#keep-alive
Will probably do the same for squad-client and squad

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant