gRPC vs GraphQL vs REST? What's the best API Technology for Golang?

Поділитися
Вставка
  • Опубліковано 6 жов 2024

КОМЕНТАРІ • 43

  • @MarioCarrion
    @MarioCarrion  2 роки тому +2

    *Blog* mariocarrion.com/
    *Software Architecture and System Design in Go* ua-cam.com/play/PL7yAAGMOat_GCd12Lrv_evJ3Zhv1dl8B-.html
    *All playlists* ua-cam.com/users/MarioCarrionplaylists
    *Keep it up!*

  • @benisrood
    @benisrood Рік тому +4

    Completely agree with these pros & cons. People shouldn't underestimate just *how* much more expensive it can be to implement GraphQL, by the way, if you are doing anything at all complex and custom in your backend (i.e. not just reading from a database). It makes the problem of overfetching in REST very small by comparison. I would say, as a general rule, try to make REST work first.

  • @fruedal
    @fruedal 2 роки тому +2

    Most underrated Go channel (see what I did there?) out there, amazing work Mario. Is there a way we can support your work?

    • @MarioCarrion
      @MarioCarrion  2 роки тому

      Thanks Felipe, I think sharing it could be a nice way to support the channel, take care!

  • @littlevintagelady
    @littlevintagelady 2 роки тому +1

    Thanks for creating this video, very clear explanation and easy to understand. Helps me as a product person to know better

    • @MarioCarrion
      @MarioCarrion  2 роки тому

      I'm glad you found the video useful, take care.

  • @yo_mono
    @yo_mono 2 роки тому +1

    This is great information, beyond the scope of Golang actually. Thanks!

    • @MarioCarrion
      @MarioCarrion  2 роки тому

      Thanks for watching Cristian, I'm glad it was useful.

  • @kalmecakrc
    @kalmecakrc 2 роки тому +2

    Me gusta como explicas, muy claro, seguiré viendo tus videos, gracias!!!

  • @mateicheles4449
    @mateicheles4449 Рік тому +1

    Regarding the under-fetching con in REST, you can just apply filters on a list endpoint and get only the permissions, w/o other users' details. sure, it's still a loop in your logic, but another endpoint like /users/{userId}/permissions to hit in each loop iteration is not really necessary.

    • @MarioCarrion
      @MarioCarrion  Рік тому +3

      Yes you can do that, but like you said that extra logic now lives on the backend side; if the goal is to dynamically get some fields over others, then why even considering REST in the first place? Go the down the GraphQL route instead. There are tradeoffs either way with whatever decision we make anyways.

  • @AbhishekRanaGuitar
    @AbhishekRanaGuitar 2 роки тому +1

    Very clear and precise!

  • @arganaphangquestian4775
    @arganaphangquestian4775 2 роки тому +1

    Awesome video as always!

  • @koro2467
    @koro2467 2 роки тому +1

    thank you for sharing this information

  • @yiyao1522
    @yiyao1522 Рік тому

    Worked at a company where we moved all our internal endpoints to gRPC, because the staff engineer that proposed it wants our backend communication protocol because it is language agnostic while our whole backend stack is written Java or in the process of migrating to Java.
    The engineer that proposed it got a promotion while the migration to gRPC provided no business and engineering value other than costing the company millions in lost engineering hours.

    • @MarioCarrion
      @MarioCarrion  Рік тому

      Being language agnostic is a nice feature, but the actual *practical* benefit when using gRPC (and really Protocol Buffers) is low latency and performance, so if there was no performance problem with your internal endpoints (assuming you mean east-west communication), then it makes no sense to change what you had at all.

    • @yiyao1522
      @yiyao1522 Рік тому

      @@MarioCarrion Rest is actually language agnostic as well, because the payload is in JSON we can serialize/deserialize in any language and there are many libraries in most languages that does that. And I don't see much performance gains in real world scenarios, because a big portion of latency in real world systems is caused by inter service communication and i/o operations on databases.
      The performance advantage of gRPC is mainly that it serialize/deserialize faster than JSON, but if there is a JSON library that serialize as fast as gRPC then gRPC's performance advantage diminishes.

    • @MarioCarrion
      @MarioCarrion  Рік тому

      For the most part, I agree with you. Ultimately, I will consider using gRPC **if** an internal service is requested millions of times per minute. Otherwise, JSON over HTTP is more than enough.

    • @yiyao1522
      @yiyao1522 Рік тому

      @@MarioCarrion At one of my previous companies we had millions of backend requests per minute and were quite performant and no latency issues. We implemented good strategies like caching, reduce the number redundent downstream network calls, had a performant backend framework that utilized asynchronous multithreading, and a performant json serialization library. There is more performance gain making those changes than the choice of network communication protocol.

  • @Peter-xn9bk
    @Peter-xn9bk 2 роки тому

    Thank you Mario. It's amazing video.

  • @kamalkamals
    @kamalkamals Рік тому

    graphql with golang is extremely hard and complicate and cannot understand the world of golang is weak on this part, then most of plugins use schema first not code first like "graphql-go", and for my personal experience until now upload file with graphql not working in golang

  • @I3ull37
    @I3ull37 2 роки тому +1

    What about gRPC-Web for Frontend to Backend gRPC use tho?

    • @MarioCarrion
      @MarioCarrion  2 роки тому +4

      Yes, that is the way to use browser clients to talk to gRPC Backends; I should made it clearer because I didn't mean it wasn't possible but more like it requires an extra step. Best!

  • @jerryevarts9292
    @jerryevarts9292 2 роки тому

    Nice recap! Thank you

    • @MarioCarrion
      @MarioCarrion  2 роки тому

      Thanks for stopping by Jerry. Take care!

  • @benevolent_queen
    @benevolent_queen 2 роки тому

    Hey Mario you explain so nicely. Alright, I have a question. I want to build an app that will be having user profiles, calling features, geo-fencing, geo-tagging, voice & photo sharing(ephemeral) and a bit of social features. Could you tell me what backend programmer should I hire? Because right now, I do have a Golang programmer who works with GRPC as well as a NodeJS developer and he works with Appsync(GraphQL). Also, I do have an iOS developer who can connect the final endpoints to the Xcode using Swift once the backend is ready. I really would like to take the serverless approach this is why AWS Lambda fits well to me but a GRPC needs an active server hence it can not be used with Lambda. Could you tell me which programmer would be best at my case for building the app logic, business logic and the complete backend.
    Please do reply.
    Thanks.

    • @MarioCarrion
      @MarioCarrion  2 роки тому +1

      Hello Alysha, I think you are already answering your question. If your goal is to build what it looks like like a mobile app using Lambdas, then GraphQL sounds like the better choice because of the pros, regarding what programmer to hire, I don't know, I think that's something you should decide and depends on their experience and/or willingness to learn/use something that they may not know yet.

  • @ruizdani3016
    @ruizdani3016 2 роки тому

    estoy confundido necesito consultar una db dgrpah con go, y tanta documentacion me dejo mas confundido donde puedo ir puntualmente para hacer esa gestion?

  • @liftingisfun2350
    @liftingisfun2350 2 роки тому

    Thanks for making this, good information and easy to digest

  • @0xc0ffee_
    @0xc0ffee_ Рік тому

    Only one thing to change about your else beautiful explanation:
    GraphQL is very inefficient performance wise. By many points of view. It also has very annoying N+1 problems that are not that easy to solve sometimes

    • @Alfrednohike9909
      @Alfrednohike9909 7 місяців тому +1

      dataloader is the solution most of the time

  • @Jam.S.
    @Jam.S. 2 роки тому

    What do you mean by mutations here?

    • @MarioCarrion
      @MarioCarrion  2 роки тому

      In GraphQL Mutations define the possible actions used to modify values: Create, Update and Delete actions basically.

  • @prashlovessamosa
    @prashlovessamosa Рік тому

    Thanks

  • @lesliestandifer
    @lesliestandifer 2 роки тому

    PATCH

  • @abgthscode6326
    @abgthscode6326 Рік тому

    I'm sorry, but your pronunciation is confusing.

    • @MarioCarrion
      @MarioCarrion  Рік тому

      Make sure you enable closed captioning, it typically works