Kafka Msg VS REST Calls

前端 未结 4 468
太阳男子
太阳男子 2021-01-31 09:32

Nowadays in microservice world, i’m seeing alot of design in my workplace that uses kafka messaging when you can achieve similar results using rest api calls between microservic

4条回答
  •  失恋的感觉
    2021-01-31 10:23

    Main benefit with kafka:

    With direct REST calls to each service - if you have N services that all need to talk to each other, that's around N^2/2 connections. You might also need to build some load balancer in front of some services that get lots of requests and maybe a queuing/buffering system within the service to queue up its requests (lol)

    With kafka, you just need N topics. It already provides its queuing system, by definition.

    Main drawback with kafka:

    The services aren't waiting for request response. It's harder to associate a response with the request once a response does show up in a topic.

提交回复
热议问题