Search code examples
javamicroservicesgrpcgrpc-java

About gRPC Capacity/Adjustment


I am running a micro service using gRPC, and got many onError() call-backs on the client side from the server.

t.printStackTrace() shows:

io.grpc.StatusRuntimeException: UNKNOWN
    at io.grpc.Status.asRuntimeException(Status.java:526)
    at io.grpc.stub.ClientCalls$StreamObserverToCallListenerAdapter.onClose(ClientCalls.java:385)
    at io.grpc.ForwardingClientCallListener.onClose(ForwardingClientCallListener.java:41)
    at io.grpc.internal.CensusTracingModule$TracingClientInterceptor$1$1.onClose(CensusTracingModule.java:339)
    at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:443)
    at io.grpc.internal.ClientCallImpl.access$300(ClientCallImpl.java:63)
    at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.close(ClientCallImpl.java:525)
    at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.access$600(ClientCallImpl.java:446)
    at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:557)
    at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
    at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:107)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)

The Exception will go away if I shut down all connections except a test client.

So, I am wondering if there are any limitations (on the server side) about the MAX numbers of instances of the:

io.grpc.ManagedChannel
io.grpc.stub.StreamObserver 

If there are some, how can I adjust/enlarge them?

Any help will be appreciated.


Solution

  • An UNKNOWN status generally means the server failed in some way. You probably want to check the server logs.

    There's no real limits to the number of connections and RPCs a server can have. It is possible to run out of file descriptors with too many connections. It is possible to reach RPC limits that would cause them to be queued until they could be sent. And as with anything, you may run into memory usage and similar limits.