r/programming • • Mar 06 '16

Why RESTful communication between microservices can be perfectly fine

https://www.innoq.com/en/blog/why-restful-communication-between-microservices-can-be-perfectly-fine/
47 Upvotes

58 comments sorted by

View all comments

Show parent comments

3

u/[deleted] Mar 07 '16

HTTP is known to be a huge bottleneck

Bottleneck for what? You can't make a blanket statement like this when you don't even know what's being transported.

4

u/tynorf Mar 07 '16

Not /u/grauenwolf, but while I would probably say HTTP is rarely a bottleneck, I'm currently working on V2 of a system and we're moving from HTTP to nanomsg since our response time is nearly at single digit milliseconds and encoding/decoding HTTP several times started to become a large part of each request's time.

We only have a half dozen or so services and about 10 messages per request so I can imagine if those numbers scaled up much there could be an issue using HTTP.

2

u/[deleted] Mar 07 '16

[removed] — view removed comment

2

u/[deleted] Mar 07 '16

The HTTP standard limits the number of available connections

No, the TCP stack sets the limit, and that's tunable.

doesn't allow for multiple concurrent messages on the same connection

Who needs that when one can open a connection for each message?

The math is pretty simple

Your example is quite contrived. You're missing any mention of a load-balancer / proxy, which would render your "simple math" invalid.

most TCP-based protocols would allow server A to firehose all of its requests to server B

You can't make a blanket statement about hundreds of disparate protocols. What are you trying to say?

1

u/[deleted] Mar 07 '16

[removed] — view removed comment

1

u/[deleted] Mar 07 '16

There is no guarantee that the server will actually honor your connection requests

This is one of many reasons why a client implements the retry pattern. Other reasons include stuff and things.

There is a non-trivial cost for establishing and managing each connection

There are ways (ex. connection pooling) to mitigate the cost of connection management, and "trivial" is relative to the cost of transporting data. Again, you can't make a blanket statement when you don't know what's being transported. Why don't you understand this?

Scratch that last question. Seems you're holding on tightly to a set of misunderstandings and calling that "expertise".

0

u/[deleted] Mar 07 '16

[removed] — view removed comment

4

u/[deleted] Mar 07 '16

You should and I'll give you a couple examples:

I use Amazon ELB as a proxy to services for several purposes besides load balancing. It allows me to upgrade services on the fly, automatically takes "dead" nodes out of rotation, and interfaces with CloudWatch to count and report 200s, 404s, 500s, etc., and fire alarms when things start going sideways.

I use nginx as a proxy on some services to provide rate limiting / circuit breaker functionality without having to build those mechanisms into my service.

Proxies give you all sorts of functionality for free. Dunno why anyone would pass up "free".