rnjai
rnjai

Reputation: 1135

Why does kafka not use http?

According to the 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.

Are there any clear reasons because this didn't seem convincing?

Upvotes: 6

Views: 4935

Answers (1)

cshu
cshu

Reputation: 5944

Kafka emphasizes performance.

Usually the overhead brought by HTTP over TCP is not big, as long as you keep your headers at a minimum size.

But if you have huge amount of small messages going back and forth, the overhead of HTTP should be considered.

The smaller your messages are, the larger percentage of size is of overhead.

--

Besides, the text-based HTTP protocol has so many features. Parsing HTTP request can be complicated, thus slower than optimized binary protocol.

(For example, even the simplest libmicrohttpd is complicated.)

Upvotes: 12

Related Questions