top of page

What is gRPC (Remote Procedure Calls)?

Oct 26
11 min read

Updated: Oct 27

gRPC client and remote service exchanging requests and responses through a shared service contract.

 

gRPC is an open source framework for remote procedure calls. It lets one application invoke a defined service method in another application, often on a different machine. Developers normally describe the service and its messages in a Protocol Buffers contract, generate client and server interfaces, then implement the actual service behaviour. Native gRPC commonly carries those calls over HTTP/2.

 

The programming interface can resemble a local method call, but the operation still crosses a network boundary. It can encounter unavailable services, permissions, queues, deadlines and uncertain outcomes. Understanding that boundary is more useful than assuming that generated code makes a remote operation behave like an ordinary function inside one process.

 

From a shared contract to a remote result

 

Imagine a monitoring client requesting a reading from a service. The contract defines the method, the request type and the response type. Client code uses a generated stub to start the call. The server runtime decodes the request and invokes the service implementation; the resulting response is encoded and returned with the RPC outcome.

 

The official gRPC core concepts explain this relationship between the service definition, generated interfaces and running applications. Protocol Buffers are the default description and message format, rather than an absolute requirement for every gRPC implementation. The contract describes the interface; it does not implement a temperature sensor, database query or business rule.

 

A small teaching contract might define a Sample message with a string label at field number 1 and an unsigned integer value at field number 2. An Echo method can accept one Sample and return one Sample. That is enough to demonstrate the boundary without pretending to build a production monitoring platform.

 

Code generation helps applications written in supported languages exchange compatible messages. It does not eliminate deployment coordination or validate every business meaning. A value can have the correct numeric type and still refer to the wrong unit, account or device. Validation and authorisation belong in the service contract and implementation.

 

The four gRPC call patterns

 

Each RPC begins with a client invoking a method. The method definition determines whether each direction contains one message or a sequence. In bidirectional streaming, the directions can progress independently; it is not necessary to pair every outgoing message with a response before sending another.

 

Pattern

Messages and a possible use

Unary

One request and one response, such as retrieving a record.

Server streaming

One request followed by a sequence of responses, such as watching readings.

Client streaming

A sequence of request messages and one response, such as summarising an upload.

Bidirectional streaming

Both sides send sequences, such as an ongoing exchange of observations and decisions.

 

Ordering is maintained within each stream direction of an individual RPC. This does not establish a single global order across unrelated calls or recreate a stream after a connection fails. If an application needs historical replay, sequence numbers or resumption, those features require a supported application design.

 

A long-lived stream also has an operational cost. It holds state and remains attached to its established backend for that call. Choosing streaming because a workload has a continuing logical flow is different from replacing every small request with a permanent stream. Assess recovery, load distribution and implementation behaviour alongside message efficiency.

 

What travels over HTTP/2?

 

The HTTP guide explains the underlying request and response model. In the documented native gRPC HTTP/2 mapping, a call uses a POST to a service-and-method path, with metadata in headers, length-prefixed messages in DATA, and a final gRPC status normally in trailing headers. An immediate outcome can instead use a trailers-only response.

 

Each message record begins with a one-byte compression flag and a four-byte length, followed by the encoded message. That length concerns the message bytes, not the complete packet. A gRPC record can cross HTTP/2 DATA frame boundaries; one network frame is not guaranteed to contain exactly one application message.

 

This nesting matters when interpreting traffic. A Protocol Buffers field, a gRPC message, an HTTP/2 stream and a TCP connection are different units. An HTTP/2 connection can carry multiple calls, while a gRPC channel is a client abstraction that may manage connections. Do not assume one channel always means exactly one live TCP socket.

 

An HTTP status of 200 is insufficient evidence that the RPC succeeded. The client must obtain the gRPC outcome, such as OK, DEADLINE_EXCEEDED or UNAVAILABLE. An intermediary returning an HTML error page is another failure mode. Looking only at ordinary HTTP access-log status can therefore conceal the information needed to diagnose the call.

 

A local check of messages, streams and outcomes

 

Techie Broadband ran a deliberately small functional check using Python 3.12.14, grpcio and grpcio-tools 1.85.0, and Protocol Buffers 7.36.2. A generated test service listened on an automatically allocated port bound to 127.0.0.1. The client and server ran on the same host, used no TLS or credentials, and were shut down after the check.

 

Our Loopback Address guide explains why that traffic stays on the computer. These observations check the behaviour of this test service and runtime. They are not measurements of UK broadband, production capacity, security, cross-language compatibility or how a browser client performs.

 

Check

Observed result

Unary Echo

The label hello and value 150 were returned with gRPC OK.

Server stream

The client received the values 1, 2 and 3 in order.

Client stream

The server summed values 2, 3 and 5 and returned 10.

Bidirectional stream

The test handler added one to each input: 10, 20 and 30 became 11, 21 and 31.

Deadline after a side effect

The client reported DEADLINE_EXCEEDED while the server’s in-memory record still contained operation-1.

 

The bidirectional handler in this particular check replied to each input. That is the handler’s design, not a requirement that all bidirectional RPCs alternate messages. Likewise, adding the uploaded numbers is test application logic rather than a feature supplied by the gRPC transport.

 

We also serialised the Sample containing label hello and value 150. It occupied 10 Protocol Buffers bytes: 0a0568656c6c6f109601 in hexadecimal. The string uses a field tag, a length and five UTF-8 bytes; the integer uses a field tag and a two-byte varint. Adding the documented five-byte uncompressed gRPC prefix gives a 15-byte message record.

 

That final 15-byte figure is a calculation from the serialised message and framing specification, not a captured packet size. It excludes headers, trailers, HTTP/2 framing, TLS, TCP, IP and link overhead. It is also not proof that every equivalent JSON message is larger, or that fewer message bytes always produce a faster complete operation.

 

Schema changes still need engineering

 

Protocol Buffers field numbers identify fields on the binary wire. They are not decorative line numbers. Do not renumber a deployed field to tidy a file or reuse a removed field’s number for a different meaning. The official language guidance recommends reserving deleted field numbers to prevent accidental reuse.

 

Compatibility depends on the particular change and representation. Binary parsing can tolerate some additions, but changing field types, application expectations or JSON representations introduces different constraints. A successful parse does not prove that an old client understands a new rule. Plan rollout, validation and tests around the actual consumers.

 

The schema can make an interface explicit while leaving important policy questions unanswered. Specify units, absent-value meanings, limits, allowed state transitions and error behaviour. A typed request that silently changes its meaning between releases can be more dangerous than a request that fails clearly.

 

Deadlines: how long is the result useful?

 

A deadline limits how long the client is willing to wait. Some language APIs accept a duration, while others accept a point in time. Set an explicit, realistic value for the operation rather than relying on an indefinite wait. The gRPC deadlines guide also explains that propagation to downstream calls depends on language and configuration.

 

A deadline budget belongs to the complete call path. Consider a fictional 250 ms budget with 35 ms travelling out, 80 ms of service work and 35 ms returning. That totals 150 ms, leaving 100 ms for other delays. Add 120 ms of queuing and the total becomes 270 ms, exceeding the budget by 20 ms.

 

Those numbers are an arithmetic illustration, not measurements or a recommended universal timeout. Connection establishment, scheduling, retries and downstream dependencies can consume time too. If a service makes another call, avoid giving it a fresh full budget that ignores time already spent. Check the runtime’s deadline propagation instead of assuming every language handles it identically.

 

For an interactive user, a response that arrives after the interface has stopped waiting may have little value. For the server, work might already have happened. Record both the client-observed status and relevant server evidence; they can describe different parts of the same attempt without either log being fabricated.

 

A timeout does not roll back a change

 

In our local deadline check, the server first appended operation-1 to an in-memory list, then deliberately waited on an event. The client used a 300 ms timeout and reported DEADLINE_EXCEEDED before the server was released. The list still contained the record. This was an artificial side effect, not a database transaction, but it makes the uncertainty concrete.

 

Cancellation signals that work is no longer wanted; it does not automatically undo a previous change. A server handler must cooperate with cancellation and arrange cleanup of work it started. The test handler deliberately waited after its append to demonstrate the distinction. Production code should check cancellation appropriately and define the outcome of partially completed work.

 

A failed reply therefore does not always mean a failed operation. If a service records a command but the reply is delayed or lost, repeating the command may repeat its effect. Use an operation identifier, a status query or an explicitly supported idempotent contract where appropriate. Idempotency explains why the meaning of a repeat matters more than simply sending it successfully.

 

gRPC has retry machinery, but the current retry guide distinguishes narrow transparent retries from a configured retry policy. A policy can select eligible statuses, attempt limits and backoff. There is no universal default policy making every failed business operation safe to replay. Once response headers commit an RPC for retry purposes, built-in retry stops; that mechanism is separate from committing a database transaction.

 

Application-level retry decisions must respect the method’s contract, remaining deadline and service capacity. Reopening a failed streaming call does not by itself recover already exchanged application state. Avoid adding an outer retry loop without considering retries already performed by the client library or another intermediary.

 

What is gRPC (Remote Procedure Calls) infographic explaining the mechanism, key stages and practical limits.

 

Flow control, connection health and service health

 

Streaming flow control regulates sending capacity so that a receiver is not overwhelmed at the transport boundary. A write accepted by the gRPC framework does not prove that the remote application stored or acted on the message. Keep bounded application queues and define what acknowledgements mean when a workflow needs completion evidence.

 

The official flow-control guidance also warns about deadlock when both peers write extensively without reading, particularly with synchronous operations or manual control. Reading and writing need a design that allows progress. Simply increasing every buffer can postpone the failure while increasing memory consumption and delay.

 

Reusing channels and stubs can avoid unnecessary setup. However, concurrent-stream limits can cause additional calls to queue, and long-lived calls can occupy capacity. Measure active calls, queue time and handler work before changing connection counts. More channels are not a general cure for a slow database or saturated broadband uplink.

 

HTTP/2 PING-based keepalive concerns the connection. It does not establish that a particular service can complete useful work. gRPC’s separate health-checking service offers Check and Watch operations, with the service owner responsible for supplying meaningful health status. Neither a Ping reply nor a poorly designed health flag proves every dependency is functioning.

 

Coordinate keepalive settings with the service operator. Aggressive unsolicited Pings can conflict with server policy and lead to connection shutdown. There is no universally correct interval for every deployment, load balancer and mobile network. Record actual idle-timeout and keepalive behaviour before attributing periodic disconnects to an ISP.

 

Security and the browser boundary

 

gRPC supports TLS for protecting transport and authenticating the server, with client certificates available for mutual authentication. Call credentials or other metadata can carry identity information under the service’s supported authentication design. Encoding data as Protocol Buffers does not encrypt it. Validate certificates, protect credentials and enforce method-level permissions.

 

Encryption and authentication also do not decide which records a caller may read or change. The service must authorise operations and validate payloads, including sensible message and resource limits. Avoid logging tokens or private message contents while collecting diagnostic evidence.

 

  • Validate the caller’s permission for the requested method and records.

  • Reject malformed messages and enforce appropriate message, rate and resource limits.

  • Keep credentials and private payloads out of routine diagnostic logs.

 

Browser JavaScript does not simply gain the native gRPC HTTP/2 interface because its browser supports HTTP/2. The gRPC-Web project provides a different browser-facing protocol, commonly translated by a compatible proxy or gateway. Its current README, checked on 26 October 2026, documents unary calls and server streaming in grpcwebtext mode, with no client or bidirectional streaming in that client.

 

That is a statement about the referenced gRPC-Web implementation and mode, not a claim that every browser library has identical capabilities. Verify the actual library, browser path and gateway configuration. The WebSockets guide covers another communication model for continuing two-way messages; those messages do not automatically implement a gRPC service contract.

 

Choosing an interface by its job

 

Need

Questions to resolve

Typed calls between controlled services

gRPC offers generated interfaces and explicit RPC outcomes. Can every client and intermediary support the chosen deployment?

A broadly accessible web API

An ordinary HTTP API may fit browser access, inspection and HTTP caching. REST is an architectural style, not a synonym for JSON or HTTP/1.1.

A continuing two-way browser channel

WebSocket can carry application messages, while security, acknowledgements and recovery still need a contract.

Buffered asynchronous work

A broker or queue can decouple submission from workers. gRPC alone is not a durable message queue.

 

These options can coexist. A website may expose a browser-friendly API while internal services use gRPC and background workers consume queued tasks. Select the boundary by interoperability, failure handling and operational needs. A generic claim that one protocol is always faster cannot replace a representative workload test.

 

Diagnosing gRPC over UK broadband

 

A home worker may encounter gRPC indirectly through desktop software, development tools or a company VPN. A healthy speed test does not establish that the application’s name resolution, TLS, proxy path and backend are correct. Conversely, a gRPC error does not automatically identify a fault on the broadband access line.

 

Latency under load is especially relevant when small RPCs share a connection with heavy uploads. More downstream Mbps cannot guarantee that a short request meets its deadline. Compare the complete application path, including Wi-Fi, VPN routing and remote service queues, while keeping the test conditions clear.

 

  1. Identify the affected method, client runtime and endpoint. Record whether unary calls, streams or both fail, along with the exact gRPC status and time.

  2. Check name resolution, endpoint reachability and TLS validation. Establish whether the request reaches the intended service before changing application retry settings.

  3. Inspect the proxy or gateway path. Confirm support for the deployed native gRPC or gRPC-Web protocol, trailers, message limits and relevant idle timeouts.

  4. Compare the deadline with client queue time, network delay, server work and downstream calls. Check propagation and cancellation in the actual language runtime.

  5. Inspect authentication, permissions and application evidence. Reconcile uncertain operations before retrying changes, and distinguish connection keepalive from service health.

  6. Compare a suitable wired path with Wi-Fi and test under controlled load where practical. Retest the application itself and verify state recovery after any stream interruption.

 

Keep the evidence specific. A local loopback check isolates local application behaviour; a remote call adds the network and service path. A gRPC status identifies a class of outcome rather than the physical location of every fault. Correlating client and server records is often more informative than repeatedly changing broadband settings.

 

Frequently asked questions

 

Is gRPC the same as Protocol Buffers?

 

No. gRPC handles remote calls and their lifecycle. Protocol Buffers normally define the service messages and encode their data. They are related layers with different jobs.

 

Does HTTP 200 mean a gRPC call succeeded?

 

No. Read the gRPC outcome as well. A native gRPC response can use HTTP 200 while reporting a non-OK gRPC status in its final metadata.

 

Does DEADLINE_EXCEEDED prove the server did nothing?

 

No. The server may already have changed state before the client stopped waiting. Check the operation’s result under the service’s contract before repeating a change.

 

Will gRPC make my broadband faster?

 

It can provide efficient structured communication for suitable applications. It does not increase access-line capacity, eliminate network delay or remove slow service dependencies.

 

What to remember

 

gRPC combines a defined service interface with a runtime for messages, streaming and RPC outcomes. Its value comes from using those facilities with a clear application contract: realistic deadlines, safe repeats, compatible schemas, meaningful health checks and verifiable results. Follow the operation beyond the method call, especially when the reply never arrives.

 
 
UK Techie Broadband Providers
bottom of page