{"id":12594,"date":"2026-01-23T11:08:18","date_gmt":"2026-01-23T11:08:18","guid":{"rendered":"https:\/\/www.mounirmaaroufi.com\/?p=12594"},"modified":"2026-01-23T20:34:59","modified_gmt":"2026-01-23T20:34:59","slug":"grpc-clearly-explained","status":"publish","type":"post","link":"https:\/\/www.mounirmaaroufi.com\/fr\/grpc-clearly-explained\/","title":{"rendered":"gRPC Clearly Explained"},"content":{"rendered":"<h1 class=\"wp-block-heading\">gRPC: What It Is and Why Teams Use It<\/h1>\n\n\n\n<p>Most teams reach for REST by habit.<\/p>\n\n\n\n<p>It works, it\u2019s everywhere, and every tool knows how to talk HTTP+JSON.<\/p>\n\n\n\n<p>But once you have dozens of microservices calling each other thousands of times per request, REST can quietly become the bottleneck.<\/p>\n\n\n\n<p>That\u2019s where gRPC shows up with a very different model: \u201ccall a function on another service as if it were local,\u201d and make it fast.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">What gRPC (and RPC) really is<\/h2>\n\n\n\n<p>Before gRPC, there\u2019s&nbsp;<strong>RPC<\/strong>.<\/p>\n\n\n\n<p><strong>Remote Procedure Call (RPC)&nbsp;<\/strong>is a model where you call a function that runs on another machine, but it feels local to the caller.<\/p>\n\n\n\n<p>You call a method, pass arguments, and get a result back. The network exists, but it\u2019s intentionally hidden so developers can think in terms of functions instead of sockets and packets.<\/p>\n\n\n\n<p>gRPC is a modern, open-source RPC framework released by Google in 2015. It takes the RPC idea and standardizes how services define methods, exchange data, and communicate efficiently over the network.<\/p>\n\n\n\n<p>Two building blocks drive almost everything you feel in practice:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>HTTP\/2<\/strong>\u00a0\u2192 The transport protocol. It keeps a long-lived connection and supports multiplexed streams.<\/li>\n\n\n\n<li><strong>Protocol Buffers (Protobuf)<\/strong>\u00a0\u2192 The data format. It\u2019s a compact binary serialization with a schema (a defined shape).<\/li>\n<\/ul>\n\n\n\n<p>Together, these turn \u201ccall a service\u201d into a strongly typed operation instead of a loosely structured document exchange.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How gRPC actually works<\/h2>\n\n\n\n<p>gRPC starts with a&nbsp;<strong>service definition<\/strong>. You describe your API in a .proto file by defining services (methods) and messages (request and response shapes).<\/p>\n\n\n\n<p>This file is the contract. Both client and server are built from it.<\/p>\n\n\n\n<p>From that contract, gRPC generates code:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Client stubs<\/strong>\u00a0\u2192 Methods you call like local functions.<\/li>\n\n\n\n<li><strong>Server interfaces<\/strong>\u00a0\u2192 Methods you implement with your business logic.<\/li>\n<\/ul>\n\n\n\n<p>When a client calls a gRPC method, the flow is straightforward:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Serialize<\/strong>\u00a0\u2192 The request is encoded into Protobuf\u2019s binary format.<\/li>\n\n\n\n<li><strong>Envoyer<\/strong>\u00a0\u2192 The message travels over an existing HTTP\/2 stream.<\/li>\n\n\n\n<li><strong>Dispatch<\/strong>\u00a0\u2192 The server routes it to the correct method.<\/li>\n\n\n\n<li><strong>Execute<\/strong>\u00a0\u2192 Your code runs.<\/li>\n\n\n\n<li><strong>Respond<\/strong>\u00a0\u2192 The result is serialized and streamed back.<\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1024\" height=\"788\" data-id=\"12595\" src=\"https:\/\/www.mounirmaaroufi.com\/wp-content\/uploads\/2026\/01\/02371727-2ddd-4fc3-99cb-ad77ebde8313_2000x1539-1024x788.webp\" alt=\"\" class=\"wp-image-12595\" title=\"\" srcset=\"https:\/\/www.mounirmaaroufi.com\/wp-content\/uploads\/2026\/01\/02371727-2ddd-4fc3-99cb-ad77ebde8313_2000x1539-1024x788.webp 1024w, https:\/\/www.mounirmaaroufi.com\/wp-content\/uploads\/2026\/01\/02371727-2ddd-4fc3-99cb-ad77ebde8313_2000x1539-300x231.webp 300w, https:\/\/www.mounirmaaroufi.com\/wp-content\/uploads\/2026\/01\/02371727-2ddd-4fc3-99cb-ad77ebde8313_2000x1539-768x591.webp 768w, https:\/\/www.mounirmaaroufi.com\/wp-content\/uploads\/2026\/01\/02371727-2ddd-4fc3-99cb-ad77ebde8313_2000x1539-16x12.webp 16w, https:\/\/www.mounirmaaroufi.com\/wp-content\/uploads\/2026\/01\/02371727-2ddd-4fc3-99cb-ad77ebde8313_2000x1539-480x369.webp 480w, https:\/\/www.mounirmaaroufi.com\/wp-content\/uploads\/2026\/01\/02371727-2ddd-4fc3-99cb-ad77ebde8313_2000x1539.webp 1456w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/figure>\n\n\n\n<p>Because gRPC uses HTTP\/2, many calls share one connection and run in parallel. A slow response doesn\u2019t block faster ones behind it, which keeps tail latency under control.<\/p>\n\n\n\n<p>Streaming uses the same mechanism:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Server-streaming<\/strong>\u00a0\u2192 One request, many responses over time.<\/li>\n\n\n\n<li><strong>Client-streaming\u00a0<\/strong>\u2192 Many requests, one final response.<\/li>\n\n\n\n<li><strong>Bidirectional streaming<\/strong>\u00a0\u2192 Both sides send messages independently.<\/li>\n<\/ul>\n\n\n\n<p>Backpressure is built in. If one side slows down, gRPC slows the stream instead of piling up memory or threads.<\/p>\n\n\n\n<p>The core idea is simple: define a strict contract, generate code from it, and move typed messages efficiently over a shared connection.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Where gRPC pays off<\/h2>\n\n\n\n<p>gRPC is a strong fit when you control both ends and you care about efficiency.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>High call volume microservices<\/strong>\u00a0\u2192 Lower per-call overhead adds up fast at scale.<\/li>\n\n\n\n<li><strong>Latency-sensitive graphs<\/strong>\u00a0\u2192 Multiplexing + smaller payloads reduces tail latency pressure.<\/li>\n\n\n\n<li><strong>Polyglot stacks<\/strong>\u00a0\u2192 One .proto contract generates stubs across languages, reducing \u201cJSON drift.\u201d<\/li>\n\n\n\n<li><strong>Service mesh environments<\/strong>\u00a0\u2192 gRPC routes cleanly through modern proxies and is common in mesh control-plane protocols.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Tradeoffs you feel immediately<\/h2>\n\n\n\n<p>gRPC\u2019s downsides are predictable, and they usually show up early on.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Browser calls are not native<\/strong>\u00a0\u2192 You often need gRPC-Web or a REST\/JSON gateway for front-end use.<\/li>\n\n\n\n<li><strong>Debugging is less \u201ccurl-friendly\u201d<\/strong>\u00a0\u2192 Binary payloads require tooling like grpcurl or GUI clients with schema access.<\/li>\n\n\n\n<li><strong>Contracts tighten coupling<\/strong>\u00a0\u2192 Clients must update generated code as schemas evolve, so versioning discipline matters.<\/li>\n\n\n\n<li><strong>Infra must support HTTP\/2 well<\/strong>\u00a0\u2192 Some proxies and firewalls need explicit support or configuration.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">How to Decide: Is gRPC a Fit for Your System?<\/h2>\n\n\n\n<p>Use gRPC when most of the following are true:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>You control both client and server<\/strong>\u00a0\u2192 Internal microservices inside the same organization.<\/li>\n\n\n\n<li><strong>You\u2019re performance-sensitive\u00a0<\/strong>\u2192 Many small calls per request, or very high QPS between services.<\/li>\n\n\n\n<li><strong>You\u2019re polyglot\u00a0<\/strong>\u2192 Multiple languages across teams and services.<\/li>\n\n\n\n<li><strong>You need streaming\u00a0<\/strong>\u2192 Real-time updates, telemetry, chat, or continuous feeds.<\/li>\n\n\n\n<li><strong>You want strict contracts\u00a0<\/strong>\u2192 You care about compile-time guarantees and explicit schemas.<\/li>\n<\/ul>\n\n\n\n<p>Stick to REST (or layer a REST gateway in front of gRPC) when:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>You expose public APIs to unknown clients.<\/li>\n\n\n\n<li>You want easy browser and curl-based experimentation.<\/li>\n<\/ul>\n\n\n\n<p>Your main pain is&nbsp;<em>clarity<\/em>&nbsp;and&nbsp;<em>discoverability<\/em>, not raw latency or throughput.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"594\" src=\"https:\/\/www.mounirmaaroufi.com\/wp-content\/uploads\/2026\/01\/b9dcfde6-49f3-4de5-b474-854453022e30_2000x1159-1024x594.webp\" alt=\"\" class=\"wp-image-12596\" title=\"\" srcset=\"https:\/\/www.mounirmaaroufi.com\/wp-content\/uploads\/2026\/01\/b9dcfde6-49f3-4de5-b474-854453022e30_2000x1159-1024x594.webp 1024w, https:\/\/www.mounirmaaroufi.com\/wp-content\/uploads\/2026\/01\/b9dcfde6-49f3-4de5-b474-854453022e30_2000x1159-300x174.webp 300w, https:\/\/www.mounirmaaroufi.com\/wp-content\/uploads\/2026\/01\/b9dcfde6-49f3-4de5-b474-854453022e30_2000x1159-768x445.webp 768w, https:\/\/www.mounirmaaroufi.com\/wp-content\/uploads\/2026\/01\/b9dcfde6-49f3-4de5-b474-854453022e30_2000x1159-18x10.webp 18w, https:\/\/www.mounirmaaroufi.com\/wp-content\/uploads\/2026\/01\/b9dcfde6-49f3-4de5-b474-854453022e30_2000x1159-480x278.webp 480w, https:\/\/www.mounirmaaroufi.com\/wp-content\/uploads\/2026\/01\/b9dcfde6-49f3-4de5-b474-854453022e30_2000x1159.webp 1456w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>In practice, most teams don\u2019t choose one or the other; they split the responsibility.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>gRPC inside your network<\/strong>\u00a0\u2192 Service-to-service, behind an API gateway or service mesh.<\/li>\n\n\n\n<li><strong>REST\/JSON at the edge<\/strong>\u00a0\u2192 For browsers, partners, and mobile apps that prefer HTTP+JSON.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Recap<\/h2>\n\n\n\n<p>gRPC is not \u201cREST but faster.\u201d<\/p>\n\n\n\n<p>It\u2019s a different model: remote procedure calls over HTTP\/2, using Protobuf contracts, with first-class support for streaming and strong typing.<\/p>\n\n\n\n<p>That makes it&nbsp;<em>excellent<\/em>&nbsp;for internal microservices, high-performance backends, and real-time systems;&nbsp;<em>as long as<\/em>&nbsp;you\u2019re willing to invest in schemas, tooling, and a slightly steeper learning curve.<\/p>\n\n\n\n<p>If you\u2019re hitting the limits of REST inside your system (too many chatty JSON calls, tricky real-time updates, or a messy polyglot codebase) gRPC is worth a serious look.<\/p>","protected":false},"excerpt":{"rendered":"<p>gRPC: What It Is and Why Teams Use It Most teams reach for REST by habit. It works, it\u2019s everywhere, and every tool knows how to talk HTTP+JSON. But once you have dozens of microservices calling each other thousands of times per request, REST can quietly become the bottleneck. That\u2019s where gRPC shows up with [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":12595,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[25],"tags":[],"class_list":["post-12594","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-web"],"_links":{"self":[{"href":"https:\/\/www.mounirmaaroufi.com\/fr\/wp-json\/wp\/v2\/posts\/12594","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mounirmaaroufi.com\/fr\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mounirmaaroufi.com\/fr\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mounirmaaroufi.com\/fr\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mounirmaaroufi.com\/fr\/wp-json\/wp\/v2\/comments?post=12594"}],"version-history":[{"count":1,"href":"https:\/\/www.mounirmaaroufi.com\/fr\/wp-json\/wp\/v2\/posts\/12594\/revisions"}],"predecessor-version":[{"id":12597,"href":"https:\/\/www.mounirmaaroufi.com\/fr\/wp-json\/wp\/v2\/posts\/12594\/revisions\/12597"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.mounirmaaroufi.com\/fr\/wp-json\/wp\/v2\/media\/12595"}],"wp:attachment":[{"href":"https:\/\/www.mounirmaaroufi.com\/fr\/wp-json\/wp\/v2\/media?parent=12594"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mounirmaaroufi.com\/fr\/wp-json\/wp\/v2\/categories?post=12594"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mounirmaaroufi.com\/fr\/wp-json\/wp\/v2\/tags?post=12594"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}