Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Microservices: REST vs Messaging

I heard Amazon uses HTTP for its microservice based architecture. An alternative is to use a messaging system like RabbitMQ or Solace systems. I personally have experience with Solace based microservice architecture, but never with REST.
Any idea what do various big league implementations like Amazon, Netflix, UK Gov etc use?
Other aspect is, in microservices, following things are required (besides others):
* Pattern matching
* Async messaging.. receiving system may be down
* Publish subscribe
* Cache load event.. i.e. on start up, a service may need to load all data from a couple of other services, and should be notified when data is completely loaded, so that it can 'know' that it is now ready to service requests
These aspects are naturally done with messaging rather than REST. Why should anyone use REST (except for public API). Thanks.

like image 761
Apurva Singh Avatar asked Dec 07 '16 05:12

Apurva Singh


People also ask

Is REST good for microservices?

The code for each service can evolve at its own pace, without affecting other services. Therefore, REST is an especially good fit for microservices, which generally rely on small, autonomous teams to develop, deploy, and scale their respective services independently.

What is the difference between REST and microservices?

Microservices: The individual services and functions – or building blocks – that form a larger microservices-based application. RESTful APIs: The rules, routines, commands, and protocols – or the glue – that integrates the individual microservices, so they function as a single application.

When should I use REST API vs message queue?

REST APIs are best suited to request/response interactions where the client application sends a request to the API backend over HTTP. Message streaming is best suited to notification when new data or events occur that you may want to take action upon.

What is messaging in microservices?

The most common type is single-receiver communication with a synchronous protocol like HTTP/HTTPS when invoking a regular Web API HTTP service. Microservices also typically use messaging protocols for asynchronous communication between microservices.

What is the difference between microservices and REST APIs?

Microservices: The individual services and functions – or building blocks – that form a larger microservices-based application. RESTful APIs: The rules, routines, commands, and protocols – or the glue – that integrates the individual microservices, so they function as a single application.

How does REST/HTTP-based communication stack up against messaging for microservices?

You may be wondering how REST/HTTP-based communication stacks up against messaging in enabling these benefits. In short, REST is an alternative to messaging and can deliver benefits 1-3 (above), but it doesn’t enable benefits 4 and 5. Let’s take up each benefit in turn, and we’ll cover the REST vs. Messaging for Microservices debate as we go.

What are some alternatives to rest microservices?

An alternative is to use a messaging system like RabbitMQ or Solace systems. I personally have experience with Solace based microservice architecture, but never with REST. Any idea what do various big league implementations like Amazon, Netflix, UK Gov etc use? These aspects are naturally done with messaging rather than REST.

What messaging system does Amazon use for REST based microservices?

I heard Amazon uses HTTP for its microservice based architecture. An alternative is to use a messaging system like RabbitMQ or Solace systems. I personally have experience with Solace based microservice architecture, but never with REST. Any idea what do various big league implementations like Amazon, Netflix, UK Gov etc use?


Video Answer


1 Answers

A standard that I've followed in the past is to use web services when the key requirement is speed (and data loss isn't critical) and messaging when the key requirement is reliability. Like you've said, if the receiving system is down, a message will sit on a queue until the system comes back up to process it. If it's a REST endpoint and it's down, requests will simply fail.

like image 92
Riaan Nel Avatar answered Sep 24 '22 20:09

Riaan Nel