Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable TCP keepalive option for executing long-run requests #807

Merged
merged 3 commits into from
Sep 27, 2022

Conversation

macsir
Copy link
Contributor

@macsir macsir commented Sep 23, 2022

Hi, @MariusWirtz
I have tested four methods and they look good to me.
The usage of this parameter is similar to the async one. If both are specified, then async_requests_mode is used by default.
with TM1Service(address, port, ssl, user, password, namespace, async_requests_mode=True, tcp_keepalive=True) as tm1:
As you can see, the TCP keepalive method captures the response a bit faster (<1s) than the async mode and since it is operating at TCP layer level, it would be more efficient (no polling and no more connections) than the async method at HTTP layer level, I suppose.
image
I don't have other cloud environments to test. If someone can confirm it in other environments, it would be good. Thanks.

Add a new utility class to update socket options
Enable TCP Keepalive option for executing long-run queries
@macsir
Copy link
Contributor Author

macsir commented Sep 26, 2022

Hi, @MariusWirtz Could you review them again? User now can setup their own values if needed. I have run three test cases with different sets of values and they are all passed. TI finished as expected and no timeout in Lambda functions. Thanks.

RestService.TCP_SOCKET_OPTIONS["TCP_KEEPIDLE"] = 45
RestService.TCP_SOCKET_OPTIONS["TCP_KEEPINTVL"] = 20
RestService.TCP_SOCKET_OPTIONS["TCP_KEEPCNT"] = 70

@MariusWirtz
Copy link
Collaborator

Nice work @macsir
This looks good. Thanks for the contribution

@MariusWirtz MariusWirtz merged commit 116ba0e into cubewise-code:master Sep 27, 2022
@MariusWirtz
Copy link
Collaborator

@macsir sorry to get back to this one so late, but I think we potentially missed a small issue here.

when you open the httpmethod function in the RestService PyCharm highlights that the local variable tcp_keepalive isn't actually used.
Am I missing something or is this a bug?

image

@macsir
Copy link
Contributor Author

macsir commented Mar 30, 2023

Hi, @MariusWirtz Yes, I think you are right and these are actually not used. Let me clean it up, run some tests and come back to you.
Sorry for the inconvenience. Thanks.

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

Successfully merging this pull request may close these issues.

2 participants