根据documention -
Kafka uses a binary protocol over TCP
Some people have asked why we don't use HTTP. There are a number of reasons, the best is that client implementors can make use of some of the more advanced TCP features--the ability to multiplex requests, the ability to simultaneously poll many connections, etc. We have also found HTTP libraries in many languages to be surprisingly shabby.
是否有任何明确的理由因为这看起来没有说服力?
最佳答案
Kafka 强调性能。
通常 HTTP over TCP 带来的开销并不大,只要您将 header 保持在最小大小即可。
但是如果您有大量的小消息来回传输,则应考虑 HTTP 的开销。
您的消息越小,开销所占的比例就越大。
--
此外,基于文本的 HTTP 协议(protocol)还有很多特点。解析 HTTP 请求可能很复杂,因此比优化的二进制协议(protocol)慢。
(例如,即使是最简单的 libmicrohttpd 也很复杂。)
关于http - 为什么kafka不用http?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35527025/