gRPC cannot assign requested address

Suppose you just run into this exception, saying that gRPC cannot assign requested address: TL;DR: most likely you opened too many connections, and you run out of ephemeral ports. Consider channel/stub reuse: https://mchesnavsky.tech/grpc-channel-stub-reuse. Details: first, we should distinguish between fixed ports, and ephemeral ports. Ephemeral ports are typically used by client devices initiating communication with […]

READ MORE

gRPC channel / stub reuse

Creating new gRPC channels and stubs involves establishing connections and negotiating capabilities with the server. Reusing them eliminates this overhead for subsequent calls. By keeping connections alive, you avoid the initial handshake delay for each RPC, leading to faster communication. However, you should ensure that reusing the channel doesn’t create a bottleneck in your application. […]

READ MORE

gRPC transport and channel providers

Let’s discuss some details around that how gRPC manages transport providers. Remember, that we have two closely related concepts in gRPC: If you didn’t familiar with NameResolvers, I strongly encourage you to peruse previous part of our narrative here: https://mchesnavsky.tech/name-resolution-providers. This article will be about the latter. Alright, we should elaborate, that a gRPC channel […]

READ MORE

gRPC channel for target was not shutdown properly

Imagine you are faced with an error like this: The point is that if you create a gRPC channel, you must close it after use. Let’s say you’ve already made a channel like this: After use, it will need to be closed. It is important to wait until it closes; awaitTermination() is used for this:

READ MORE