-1

Essentially, what I'm asking is, why use HTTP for anything when TCP alone could suffice? HTTP operates on top of TCP, so by sticking to TCP alone, you simplify parsing and avoid the added complexity of HTTP.

I came across an article discussing WhatsApp's tech stack, noting their use of HTTP for their mobile app. It immediately occurred to me that sticking solely to TCP could potentially enhance performance.

article : https://intuji.com/whatsapp-tech-stack-explored/

1
  • "avoid the added complexity of HTTP" - one might argue that HTTP is actually reducing the complexity =) Commented May 12, 2024 at 20:26

1 Answer 1

1

There are many reasons to stick with a technology even if it does not look like the most optimal suited to the problem. At the end it is about weighing advantages against disadvantages.

As for the advantages:

  • The technology is well established in practice, i.e. in case of HTTP it is well tested set of applications and libraries supporting the protocol, etc.
  • The technology has a clear future, which can clearly be seen by the continuous development of HTTP (i.e. HTTP/1, HTTP/2, now HTTP/3).
  • It is comparably easy to get developers with knowledge of the technology.
  • Specific for HTTP is also that it works well within restricted environments, where firewalls or proxies are common place. Just do something on top of TCP often gets blocked.

Compared to these advantages the disadvantage of some more overhead is acceptable. Also, if any theoretical performance advantages of a protocol with less overhead are really noticeable in practice is questionable. The network performance is usually dominated by the latency of the link and not by the (small) overhead of the communication protocol.

Sign up to request clarification or add additional context in comments.

4 Comments

but what about grpc why they use http they can just stick to tcp ?
@younesaskour: Not sure what you mean with this comment. Are you asking why gprc is using HTTP as the underlying protocol? Probably for the same reasons I've already mentioned.
okey one last question do you know any backend frameworks that use just tcp ( and i am sorry if i seem rude english is my second language)
@younesaskour: I don't know such a framework, at least not for the usual mobile/web frontend + some backend architecture. Other protocols are used in other situations.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.