{"id":6228,"date":"2023-01-31T14:28:08","date_gmt":"2023-01-31T13:28:08","guid":{"rendered":"https:\/\/kabisa.nl\/?p=6228"},"modified":"2023-10-24T12:24:11","modified_gmt":"2023-10-24T10:24:11","slug":"grpc-vs-its-alternatives-rest-graphql-etc","status":"publish","type":"post","link":"https:\/\/kabisa.nl\/en\/tech\/grpc-vs-its-alternatives-rest-graphql-etc\/","title":{"rendered":"gRPC vs its alternatives (REST, GraphQL etc.)"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"6228\" class=\"elementor elementor-6228\" data-elementor-post-type=\"post\">\n\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-0679db2 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"0679db2\" data-element_type=\"section\" data-e-type=\"section\" data-settings=\"{&quot;jet_parallax_layout_list&quot;:[]}\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-7b678a0\" data-id=\"7b678a0\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-34be2c4 elementor-widget elementor-widget-text-editor\" data-id=\"34be2c4\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>gRPC is a promising communication technique that has already gained a considerable footprint in the API area. It\u2019s been around since 2012 and there are many leading tech companies adopting gRPC, such as Google, Netflix, &amp; IBM. It\u2019s becoming more popular, and it\u2019s good to know what it is and how to decide when to use it. Nowadays, you could see gRPC as an alternative to REST and GraphQL from a request\/response perspective and an alternative to WebSockets from a streaming perspective.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-d826d16 elementor-widget elementor-widget-text-editor\" data-id=\"d826d16\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<h2 id=\"what-is-grpc\">What is GRPC<\/h2><p>gRPC is a high performance, open source remote procedure call (RPC) framework. A remote procedure call (RPC) is when a program can execute a procedure on another machine as if it were a normal (local) method. gRPC can be used with different data formats, but usually and by default Protocol Buffers are used. This is a language-independent, binary file format for serializing data. It also has backward and forward compatibility support.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-9533214 elementor-widget elementor-widget-image\" data-id=\"9533214\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img fetchpriority=\"high\" decoding=\"async\" width=\"800\" height=\"513\" src=\"https:\/\/kabisa.nl\/wp-content\/uploads\/2023\/10\/gRPC_diagram_.png\" class=\"attachment-large size-large wp-image-6230\" alt=\"\" srcset=\"http:\/\/kabisa.nl\/wp-content\/uploads\/2023\/10\/gRPC_diagram_.png 946w, http:\/\/kabisa.nl\/wp-content\/uploads\/2023\/10\/gRPC_diagram_-300x192.png 300w, http:\/\/kabisa.nl\/wp-content\/uploads\/2023\/10\/gRPC_diagram_-768x493.png 768w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-f89795c elementor-widget elementor-widget-text-editor\" data-id=\"f89795c\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<h2 id=\"advantages-of-protocol-buffers\">Advantages of protocol buffers:<\/h2><ol><li>Compact in data format.<\/li><li>Parsing performance.<\/li><li>Support in many programming languages.<\/li><li>Optimal functionality through generated code.<\/li><\/ol><h2 id=\"grpc-use-cases\">gRPC use cases<\/h2><p>The main reason for using gRPC is performance. For example, gRPC is 7 times faster than REST when receiving data &amp; 10 times faster than REST when sending data for a payload<a href=\"https:\/\/medium.com\/@EmperorRXF\/evaluating-performance-of-rest-vs-grpc-1b8bdf0b22da#:~:text=gRPC%20is%20roughly%207%20times,of%20HTTP%2F2%20by%20gRPC.\">(Source)<\/a>. This is mainly due to the tight packing of Protocol Buffers and the usage of HTTP\/2.<\/p><p>Besides the main advantage, gRPC could be considered in the following use cases for projects:<\/p><ol><li>For mobile applications and IoT Devices since they do not need a web browser and can benefit from small, efficient messages (Protocol Buffers). This results in less data traffic and also preserving a tablet\/mobile\u2019s CPU usage (which saves on battery).<\/li><li>For communication between internal (micro) services, especially in multi-language systems. Since gRPC provides the possibility to define a strong API contract\u00a0<a href=\"https:\/\/gist.github.com\/agreatfool\/5e3a41052c6dd2f6d04b30901fc0269b\">(Proto file)<\/a>, this file can be used to generate code in multiple supported languages (Java, C#, Go etc.). In this way, the generated code can be used for services to call each other while being in a different language.<\/li><li>For inter process communication, it\u2019s becoming more and more the standard. Examples are Unix sockets and named pipes that can be used with gRPC to communicate between applications on the same machine.<\/li><\/ol><h2 id=\"alternatives-to-grpc\">Alternatives to gRPC<\/h2><p>There could also be alternatives like:<\/p><ol><li>REST API is generally the most simple and popular choice, since it has become quite the industry standard. It\u2019s most suited for web (client)- server communication and public API\u2019s.<\/li><li>GraphQL is relevant if you want a flexible API where different clients make custom requests. In this way, it\u2019s possible from the client side to get the specific data they need.<\/li><li>WebSockets is a better fit when the system is sending the same message to multiple users at once. Various WebSocket libraries implement broadcasting over WebSockets (usually via pub\/sub mechanism for messaging). Whereas, gRPC does not natively support broadcasting.<ul><li>For web related streaming, WebSockets should be the preferred way, since you probably want to support all browsers. In gRPC there is a workaround using\u00a0<a href=\"https:\/\/github.com\/grpc\/grpc-web\">grpc-web<\/a>. But this introduces extra complexity within the architecture by adding a proxy.<\/li><\/ul><\/li><\/ol><p>Keep in mind that in a real life project, there are always requirements that do not fully match a given communication protocol. If that happens, try a small PoC with one or two communication protocols and check what fits best. It\u2019s also wise to note that decisions could be made based on business constraints, e.g: What skills do we have with our current team? Or what is our budget for this project?<\/p><h2 id=\"grpc-limitations\">gRPC limitations<\/h2><p>When considering gRPC, make sure you are aware of the following limitations.<\/p><ol><li>Lack of maturity, which could lead to a steep learning curve.<ul><li>If you compare gRPC\u00a0<a href=\"https:\/\/stackoverflow.com\/questions\/tagged\/grpc\">5.6k s\/o questions<\/a>\u00a0to REST\u00a0<a href=\"https:\/\/stackoverflow.com\/questions\/tagged\/rest\">90k s\/o question<\/a>\u00a0or GraphQL\u00a0<a href=\"https:\/\/stackoverflow.com\/questions\/tagged\/graphql\">19.4k s\/o questions.<\/a>\u00a0This could mean that gRPC could lack information about issues, proper documentation, best practices, workarounds, and success stories. But this is likely to change soon as gRPC is getting adopted more and more.<\/li><\/ul><\/li><li>Limited Browser Support<ul><li>No modern browser provides the control needed over web requests to support a gRPC client. Therefore, a proxy layer\u00a0<a href=\"https:\/\/github.com\/grpc\/grpc-web\">grpc-web<\/a>\u00a0is required to perform conversion between HTTP\/1.1 and HTTP\/2 which also introduces extra complexity in the architecture.<\/li><\/ul><\/li><li>Extra Maintenance overhead<ul><li>If gRPC is a new communication protocol for your tech stack, it could bring in some additional complexity. Because maintaining a gRPC project could require new tools and knowledge which will add additional overhead to the maintainers.<\/li><\/ul><\/li><li>No caching by default<ul><li>Caching requests and responses are by default not supported in gRPC. A workaround could be a custom middleware layer, but this will introduce extra complexity in the architecture.<\/li><\/ul><\/li><\/ol><h2 id=\"conclusion\">Conclusion<\/h2><p>We\u2019ve explored the use cases for gRPC and possible alternatives (REST, WebSockets and GraphQL). We\u2019ve also gone through some major benefits of using gRPC, as well as its limitations. Hopefully, this article has helped you to understand what gRPC is, the alternatives besides gRPC and how you should make a decision on either.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>gRPC is a promising communication technique that has already gained a considerable footprint in the API area. It\u2019s been around since 2012 and there are many leading tech companies adopting gRPC, such as Google, Netflix, &amp; IBM. It\u2019s becoming more popular, and it\u2019s good to know what it is and how to decide when to [&hellip;]<\/p>\n","protected":false},"author":9,"featured_media":6482,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[149],"tags":[],"class_list":["post-6228","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tech"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v28.4 (Yoast SEO v28.6) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>gRPC vs its alternatives (REST, GraphQL etc.) | Kabisa Software Artisans<\/title>\n<meta name=\"description\" content=\"gRPC is a promising communication technique that has already gained a considerable footprint in the API area. It\u2019s been around since 2012 and there are\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/kabisa.nl\/en\/tech\/grpc-vs-its-alternatives-rest-graphql-etc\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"gRPC vs its alternatives (REST, GraphQL etc.) | Kabisa Software Artisans\" \/>\n<meta property=\"og:description\" content=\"gRPC is a promising communication technique that has already gained a considerable footprint in the API area. It\u2019s been around since 2012 and there are\" \/>\n<meta property=\"og:url\" content=\"https:\/\/kabisa.nl\/en\/tech\/grpc-vs-its-alternatives-rest-graphql-etc\/\" \/>\n<meta property=\"og:site_name\" content=\"Kabisa Software Artisans\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/kabisaict\" \/>\n<meta property=\"article:published_time\" content=\"2023-01-31T13:28:08+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-10-24T10:24:11+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/kabisa.nl\/wp-content\/uploads\/2023\/01\/gRPC_vs_its_alternatives__REST__GraphQL_etc._-min.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"David Weng\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"David Weng\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"gRPC vs its alternatives (REST, GraphQL etc.) | Kabisa Software Artisans","description":"gRPC is a promising communication technique that has already gained a considerable footprint in the API area. It\u2019s been around since 2012 and there are","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/kabisa.nl\/en\/tech\/grpc-vs-its-alternatives-rest-graphql-etc\/","og_locale":"en_US","og_type":"article","og_title":"gRPC vs its alternatives (REST, GraphQL etc.) | Kabisa Software Artisans","og_description":"gRPC is a promising communication technique that has already gained a considerable footprint in the API area. It\u2019s been around since 2012 and there are","og_url":"https:\/\/kabisa.nl\/en\/tech\/grpc-vs-its-alternatives-rest-graphql-etc\/","og_site_name":"Kabisa Software Artisans","article_publisher":"https:\/\/www.facebook.com\/kabisaict","article_published_time":"2023-01-31T13:28:08+00:00","article_modified_time":"2023-10-24T10:24:11+00:00","og_image":[{"width":1200,"height":630,"url":"https:\/\/kabisa.nl\/wp-content\/uploads\/2023\/01\/gRPC_vs_its_alternatives__REST__GraphQL_etc._-min.png","type":"image\/png"}],"author":"David Weng","twitter_misc":{"Written by":"David Weng","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/kabisa.nl\/en\/tech\/grpc-vs-its-alternatives-rest-graphql-etc\/#article","isPartOf":{"@id":"https:\/\/kabisa.nl\/en\/tech\/grpc-vs-its-alternatives-rest-graphql-etc\/"},"author":{"name":"David Weng","@id":"https:\/\/kabisa.nl\/en\/#\/schema\/person\/34cd0cee7f712534ca2cbe5be7e69b88"},"headline":"gRPC vs its alternatives (REST, GraphQL etc.)","datePublished":"2023-01-31T13:28:08+00:00","dateModified":"2023-10-24T10:24:11+00:00","mainEntityOfPage":{"@id":"https:\/\/kabisa.nl\/en\/tech\/grpc-vs-its-alternatives-rest-graphql-etc\/"},"wordCount":856,"commentCount":0,"publisher":{"@id":"https:\/\/kabisa.nl\/en\/#organization"},"image":{"@id":"https:\/\/kabisa.nl\/en\/tech\/grpc-vs-its-alternatives-rest-graphql-etc\/#primaryimage"},"thumbnailUrl":"https:\/\/kabisa.nl\/wp-content\/uploads\/2023\/01\/gRPC_vs_its_alternatives__REST__GraphQL_etc._-min.png","articleSection":["Tech blog"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/kabisa.nl\/en\/tech\/grpc-vs-its-alternatives-rest-graphql-etc\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/kabisa.nl\/en\/tech\/grpc-vs-its-alternatives-rest-graphql-etc\/","url":"https:\/\/kabisa.nl\/en\/tech\/grpc-vs-its-alternatives-rest-graphql-etc\/","name":"gRPC vs its alternatives (REST, GraphQL etc.) | Kabisa Software Artisans","isPartOf":{"@id":"https:\/\/kabisa.nl\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/kabisa.nl\/en\/tech\/grpc-vs-its-alternatives-rest-graphql-etc\/#primaryimage"},"image":{"@id":"https:\/\/kabisa.nl\/en\/tech\/grpc-vs-its-alternatives-rest-graphql-etc\/#primaryimage"},"thumbnailUrl":"https:\/\/kabisa.nl\/wp-content\/uploads\/2023\/01\/gRPC_vs_its_alternatives__REST__GraphQL_etc._-min.png","datePublished":"2023-01-31T13:28:08+00:00","dateModified":"2023-10-24T10:24:11+00:00","description":"gRPC is a promising communication technique that has already gained a considerable footprint in the API area. It\u2019s been around since 2012 and there are","breadcrumb":{"@id":"https:\/\/kabisa.nl\/en\/tech\/grpc-vs-its-alternatives-rest-graphql-etc\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/kabisa.nl\/en\/tech\/grpc-vs-its-alternatives-rest-graphql-etc\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/kabisa.nl\/en\/tech\/grpc-vs-its-alternatives-rest-graphql-etc\/#primaryimage","url":"https:\/\/kabisa.nl\/wp-content\/uploads\/2023\/01\/gRPC_vs_its_alternatives__REST__GraphQL_etc._-min.png","contentUrl":"https:\/\/kabisa.nl\/wp-content\/uploads\/2023\/01\/gRPC_vs_its_alternatives__REST__GraphQL_etc._-min.png","width":1200,"height":630},{"@type":"BreadcrumbList","@id":"https:\/\/kabisa.nl\/en\/tech\/grpc-vs-its-alternatives-rest-graphql-etc\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/kabisa.nl\/en\/"},{"@type":"ListItem","position":2,"name":"Tech blog","item":"https:\/\/kabisa.nl\/en\/tech\/"},{"@type":"ListItem","position":3,"name":"gRPC vs its alternatives (REST, GraphQL etc.)"}]},{"@type":"WebSite","@id":"https:\/\/kabisa.nl\/en\/#website","url":"https:\/\/kabisa.nl\/en\/","name":"Kabisa Software Artisans","description":"Mission-critical Software for Hightech, Fintech &amp; E-commerce","publisher":{"@id":"https:\/\/kabisa.nl\/en\/#organization"},"alternateName":"Kabisa","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/kabisa.nl\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/kabisa.nl\/en\/#organization","name":"Cloud Legends","alternateName":"Kabisa","url":"https:\/\/kabisa.nl\/en\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/kabisa.nl\/en\/#\/schema\/logo\/image\/","url":"https:\/\/kabisa.nl\/wp-content\/uploads\/2022\/12\/kabisa-favicon.png","contentUrl":"https:\/\/kabisa.nl\/wp-content\/uploads\/2022\/12\/kabisa-favicon.png","width":512,"height":512,"caption":"Cloud Legends"},"image":{"@id":"https:\/\/kabisa.nl\/en\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/kabisaict","https:\/\/x.com\/kabisasoftware"],"description":"Software Development is onze core-business. Kabisa ontwikkelt innovatieve maatwerk software die naadloos aansluit bij de behoeftes van klanten en eindgebruikers. Dat doen we in nauwe samenwerking in elke fase van het proces: co-creatie noemen we dat.","email":"info@kabisa.nl","telephone":"0495 430 798","legalName":"Kabisa B.V.","foundingDate":"2006-01-01","numberOfEmployees":{"@type":"QuantitativeValue","minValue":"51","maxValue":"200"}},{"@type":"Person","@id":"https:\/\/kabisa.nl\/en\/#\/schema\/person\/34cd0cee7f712534ca2cbe5be7e69b88","name":"David Weng","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/16c42888627e13f14d36f0b81d42160505c20741ebf51c1fd1435d0aeeb9ed3b?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/16c42888627e13f14d36f0b81d42160505c20741ebf51c1fd1435d0aeeb9ed3b?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/16c42888627e13f14d36f0b81d42160505c20741ebf51c1fd1435d0aeeb9ed3b?s=96&d=mm&r=g","caption":"David Weng"}}]}},"_links":{"self":[{"href":"https:\/\/kabisa.nl\/en\/wp-json\/wp\/v2\/posts\/6228","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kabisa.nl\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kabisa.nl\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kabisa.nl\/en\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"https:\/\/kabisa.nl\/en\/wp-json\/wp\/v2\/comments?post=6228"}],"version-history":[{"count":6,"href":"https:\/\/kabisa.nl\/en\/wp-json\/wp\/v2\/posts\/6228\/revisions"}],"predecessor-version":[{"id":6237,"href":"https:\/\/kabisa.nl\/en\/wp-json\/wp\/v2\/posts\/6228\/revisions\/6237"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kabisa.nl\/en\/wp-json\/wp\/v2\/media\/6482"}],"wp:attachment":[{"href":"https:\/\/kabisa.nl\/en\/wp-json\/wp\/v2\/media?parent=6228"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kabisa.nl\/en\/wp-json\/wp\/v2\/categories?post=6228"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kabisa.nl\/en\/wp-json\/wp\/v2\/tags?post=6228"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}