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

chore: support keepalive and deadline configuration for grpc sink #19

Merged
merged 6 commits into from
Jan 16, 2024

Conversation

mayankrai09
Copy link

@mayankrai09 mayankrai09 commented Aug 31, 2023

Hey, I just made a Pull Request!

Adding capabilities to set deadlines, keepalive_time, and keepalive_timeout for grpc sink.

keepalive_time and keepalive_timeout helps early identify half-open connection.
Linux by default has a mechanism to detect less-clean failure (half-open connection) with net.ipv4.tcp_retries2. This has a default value of 15. Only when that number is reached, the OS will forcefully terminate the “half-open” connection and force the connection to be recreated.

Deadlines allow gRPC clients to specify how long they are willing to wait for an RPC to complete before the RPC is terminated with the error DEADLINE_EXCEEDED. If you don’t set a deadline, resources will be held for all in-flight requests, and all requests can potentially reach the maximum timeout. Which would increase the latency of the service.

@mayankrai09 mayankrai09 changed the title chore: add keepalive and deadline configuration for grpc sink chore: support keepalive and deadline configuration for grpc sink Aug 31, 2023

return dynamicMessage;
protected CallOptions decorateCallOptions(CallOptions defaultCallOption) {
Copy link
Member

@lavkesh lavkesh Sep 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

    protected CallOptions decorateCallOptions() {
        CallOptions defaultCallOption = CallOptions.DEFAULT;
        if (grpcSinkConfig.getSinkGrpcArgDeadlineMS() != null && grpcSinkConfig.getSinkGrpcArgDeadlineMS() > 0) {
            return defaultCallOption.withDeadlineAfter(grpcSinkConfig.getSinkGrpcArgDeadlineMS(), TimeUnit.MILLISECONDS);
        }
        return defaultCallOption;
    }

Copy link
Member

@lavkesh lavkesh Sep 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be checked.. let's think about a default value.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default grpc client don't set any default value. Not sure what would be right default value for us. I would prefer not to have any default value for deadline.

@mayankrai09 mayankrai09 marked this pull request as ready for review October 27, 2023 11:42
@mayankrai09
Copy link
Author

@lavkesh - Can we merge this PR?

@mayankrai09 mayankrai09 force-pushed the chor/deadline_keepalive branch from 8d30798 to f3cb6b2 Compare January 16, 2024 10:42
@lavkesh lavkesh merged commit 7a66d9f into main Jan 16, 2024
1 check passed
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