Skip to content

[Prism] Set keepalive policy for grpc server. - #37021

Merged
shunping merged 2 commits into
apache:masterfrom
shunping:prism-grpc-server-options
Dec 8, 2025
Merged

[Prism] Set keepalive policy for grpc server.#37021
shunping merged 2 commits into
apache:masterfrom
shunping:prism-grpc-server-options

Conversation

@shunping

@shunpingshunping commented Dec 6, 2025

Copy link
Copy Markdown
Collaborator

After the changes in FnApiRunner grpc server setting (#37013), one test is still flaky due to too-many-ping grpc error(https://github.com/apache/beam/actions/runs/19973942914/job/57285283120).

It seems that this test is running with prism (verified in a debugging PR #37020): https://github.com/apache/beam/actions/runs/19981955990/job/57309934542?pr=37020

This PR is to change the options of Prism grpc server, so it won't complain about the ping frequency of the client.

Notice that the default min ping frequency in the server option is 5 mins (https://pkg.go.dev/google.golang.org/grpc@v1.77.0/keepalive#EnforcementPolicy)

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @shunping, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the robustness of the Prism gRPC server by implementing a keepalive enforcement policy. This policy ensures that client connections remain active and are not prematurely terminated by network intermediaries, which is crucial for the stability and reliability of job management services. The changes specifically set a minimum ping interval and allow pings on idle connections.

Highlights

  • gRPC Keepalive Policy: Introduced a keepalive enforcement policy for the Prism gRPC server to maintain stable connections.
  • Minimum Keepalive Time: Configured the minimum time a client should wait before sending a keepalive ping to 20 seconds.
  • Permit Pings Without Streams: Enabled the gRPC server to permit keepalive pings even when there are no active streams, preventing idle connection closures.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

FeatureCommandDescription
Code Review/gemini reviewPerforms a code review for the current pull request in its current state.
Pull Request Summary/gemini summaryProvides a summary of the current pull request in its current state.
Comment@gemini-code-assistResponds in comments when explicitly tagged, both in pull request comments and review comments.
Help/gemini helpDisplays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@shunping
shunpingforce-pushed the prism-grpc-server-options branch from dd3ebdd to 0cdae50CompareDecember 6, 2025 03:32
@shunping
shunpingforce-pushed the prism-grpc-server-options branch from 0cdae50 to b28cc6fCompareDecember 6, 2025 03:32
opts := []grpc.ServerOption{
grpc.MaxRecvMsgSize(math.MaxInt32),
grpc.KeepaliveEnforcementPolicy(keepalive.EnforcementPolicy{
MinTime: 20 * time.Second, // Minimum duration a client should wait before sending a keepalive ping

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

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

@shunpingshunping changed the title Set keepalive policy for prism grpc server.[Prism] Set keepalive policy for grpc server.Dec 6, 2025
@shunping
shunping marked this pull request as ready for review December 6, 2025 03:36
@github-actions

Copy link
Copy Markdown
Contributor

Checks are failing. Will not request review until checks are succeeding. If you'd like to override that behavior, comment assign set of reviewers

@shunping

Copy link
Copy Markdown
CollaboratorAuthor

Failure of PreCommit Java PVR Prism Loopback seems to be related to #36897.

@github-actions

Copy link
Copy Markdown
Contributor

Assigning reviewers:

R: @lostluck for label go.

Note: If you would like to opt out of this review, comment assign to next reviewer.

Available commands:

  • stop reviewer notifications - opt out of the automated review tooling
  • remind me after tests pass - tag the comment author after tests pass
  • waiting on author - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)

The PR bot will only process comments in the main thread (not review comments).

@shunping
shunping merged commit 3ea5e1f into apache:masterDec 8, 2025
14 checks passed
shunping added a commit to shunping/beam that referenced this pull request Dec 11, 2025
shunping added a commit that referenced this pull request Dec 11, 2025
* Fix too-many-pings on FnAPI runner under grpc mode (#37013)
* Fix too-many-pings on FnAPI runner under grpc mode
* Fix lints
* Set keepalive policy for prism grpc server. (#37021)
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@shunping@tvalentyn