Grpc-java: How do I set the GRPC_ARG_KEEPALIVE_TIME_MS parameter on the server?

Created on 21 Feb 2020  路  1Comment  路  Source: grpc/grpc-java

Make sure you include information that can help us understand your question. -->

By default, the GRPC_ARG_KEEPALIVE_TIME_MS parameter is set to 2h on the server. How can I change this?

question

Most helpful comment

I use this:

     // implementation of the service:
     MyService boxService = new MyService();

     NettyServerBuilder nettyBuilder = NettyServerBuilder.forPort(ssl_port)

                    .permitKeepAliveWithoutCalls(true)

                    .permitKeepAliveTime(5, TimeUnit.SECONDS);

    nettyBuilder.addService(boxService);

    Service server =  nettyBuilder
                    .build();

KeepAlive is a client decision. This allows the client so send keep-alives every 5 seconds, even if no calls are active. Helpful for streaming calls, where you can't use deadlines really.

>All comments

I use this:

     // implementation of the service:
     MyService boxService = new MyService();

     NettyServerBuilder nettyBuilder = NettyServerBuilder.forPort(ssl_port)

                    .permitKeepAliveWithoutCalls(true)

                    .permitKeepAliveTime(5, TimeUnit.SECONDS);

    nettyBuilder.addService(boxService);

    Service server =  nettyBuilder
                    .build();

KeepAlive is a client decision. This allows the client so send keep-alives every 5 seconds, even if no calls are active. Helpful for streaming calls, where you can't use deadlines really.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ejona86 picture ejona86  路  19Comments

njhill picture njhill  路  16Comments

vlsinitsyn picture vlsinitsyn  路  42Comments

gertvdijk picture gertvdijk  路  15Comments

carl-mastrangelo picture carl-mastrangelo  路  25Comments