Sunday, August 28, 2022
gRPC vs REST vs GraphQL
๐๐ฟ๐ฎ๐ฝ๐ต๐น๐ค๐ is a data query language that uniquely allows clients to request any specific data that they need. As opposed to RESTโs HTTP methods, GraphQL uses queries, mutations, and subscriptions for sourcing and manipulating data. Queries request data from the server while mutations send data to and modify data gated by the server. Subscriptions get live updates when data changes, usually through Websockets.
๐ฅ๐๐ฆ๐ง The most popular and most used API format on the list is REST, which stands for representational state transfer. REST APIs use HTTP methods like GET, POST, PUT, and DELETE to access and manipulate data within uniform resource identifiers (URIs).
๐ด๐ฅ๐ฃ๐ is a high-performance, open source remote procedural call (RPC) framework created by Google. In gRPC, protocol buffers make API requests to the server. These API requests and responses are protocol buffer messages, and each one must have its own type defined using the protocol buffers language.
So, ๐๐ต๐ถ๐ฐ๐ต ๐ผ๐ป๐ฒ ๐ถ๐ ๐๐ต๐ฒ ๐ฏ๐ฒ๐๐?
- The winner is, of course, โ๐ถ๐ ๐ฑ๐ฒ๐ฝ๐ฒ๐ป๐ฑ๐.โ Each technology has strong benefits, but those come with trade-offs. Your needs may best be served by a combination of technologies.
- ๐ฅ๐๐ฆ๐ง, ๐ผ๐ฟ ๐ฎ๐ ๐น๐ฒ๐ฎ๐๐ ๐๐ฆ๐ข๐ก ๐ผ๐๐ฒ๐ฟ ๐๐ง๐ง๐ฃ, is the most ubiquitous standard for web-based APIs. This means itโs easy to get started, you can use a wide variety of languages, and it works natively with web browsers.
- In their own way, ๐๐ฟ๐ฎ๐ฝ๐ต๐ค๐ ๐ฎ๐ป๐ฑ ๐ด๐ฅ๐ฃ๐ address some of the limitations of REST.
- ๐๐ฟ๐ฎ๐ฝ๐ต๐ค๐ allows a client to specify just the information they need, which can greatly reduce duplicate or unnecessary data being transmitted. But, it requires additional setup and training.
- ๐ด๐ฅ๐ฃ๐ is built for fast transport, leveraging HTTP/2. This requires a well known contract, typically using Protocol Buffers, that is shared by the client and server.
Subscribe to:
Posts (Atom)