We use NServiceBus for our messaging architecture. It has a lot of the negatives covered in this.
Is REST Best in a Microservices Architecture?
31–40 of 51 posts
Re: Is REST Best in a Microservices Architecture?
#32I think the problems identified with the architecture are being wrongly imputed on REST. REST is synchronous in terms of request/reply, but that doesn't mean that higher-level actions must (or even should) be restricted to that cycle, so subprocesses like the notification should never have to block the stock update. Even if the requester needs to be informed about that, the stock updating mechanism should instead cre…
You point about the SPOF is that you prefer distributed state inside the individual services over having events stored in the message bus? Then you're back to high coupling between the inventory manager and notifier, if the former is down the latter won't be able to send out any notifications.
Re: Is REST Best in a Microservices Architecture?
#33I'm currently working at a startup that has about 15 microservices and there are a few different strategies that we use to solve the problems being described in this article:
We do use HTTP REST style requests when one service needs to fetch data from another service on the fly (usually in response to a user query), but we put in timeouts and proper error handling in case the dependent service is misbehaving. We strive for a "minimally broken" experience by allowing parts of the experience to degrade if one microservice is over capacity or broken, and have designed our response to allow us to return at least some data as long as part of the system is still working. This solves the "coupling", and "when microservices go pop" problem in the article.
REST should be considered to be the interface for anything requiring realtime feedback, but not everything does require immediate processing, or immediate feedback. So for example there is no reason why the notification service should block anything as depicted in the authors example. The notification service could accept a POST request to dispatch the notification and immediately return a 200 response after placing the notification onto a queue. Then it can process the queue in the background in a non blocking manner. At some later point in time if a delivery receipt is absolutely required there can be a callback hook into the other service.
REST makes for a very nice interface when used in an appropriate setting, but it isn't necessarily the best thing for all parts of the microservice communication. But neither is a service bus, or pipeline the best implementation for everything. The most masterfully designed backend will use REST when that is appropriate, and use a messaging/queue system when that is appropriate. Any non trivial backend will probably require both.
Re: Is REST Best in a Microservices Architecture?
#34It is rather a bold claim that REST is synchronous by nature. Synchronous only means less complexity, but it is by far not a standard. Considering the example in the article, calls to EmailService should be asynchronous and rather return '202 Accepted' instead of blocking.
Re: Is REST Best in a Microservices Architecture?
#35Of course, above described approach is just an (opinionated) option and by no means the only, or best solution. Cockcroft defines a microservices architecture as a service-oriented architecture composed of loosely coupled elements that have bounded contexts. Loosely coupled meaning you can develop, update, and deploy separately. Bounded contexts meaning you can understand and update the microservice’s code without knowing anything about the internals of its peers. I think this is the best description as it leaves completely open how one would achieve this. In other words, as long as it works for your situation it's fine.
Re: Is REST Best in a Microservices Architecture?
#36I just love the way that consultancies are selling micro services as though it's some big thing that will revolutionise their business. Like big data or the cloud before it. Looking at the article it seems that you've got an event driven system at the end with some components / pieces of code handling events e.g. Update inventory, inventory updated.
Re: Is REST Best in a Microservices Architecture?
#37REST is not the source of the problem being described in the article. The problem in the article is from bad application of REST. I'm currently working at a startup that has about 15 microservices and there are a few different strategies that we use to solve the problems being described in this article: We do use HTTP REST style requests when one service needs to fetch data from another service on the fly (usually in…
Re: Is REST Best in a Microservices Architecture?
#38I think the problems identified with the architecture are being wrongly imputed on REST. REST is synchronous in terms of request/reply, but that doesn't mean that higher-level actions must (or even should) be restricted to that cycle, so subprocesses like the notification should never have to block the stock update. Even if the requester needs to be informed about that, the stock updating mechanism should instead cre…
That polling endpoint is a message bus, just disguised as a REST endpoint. You point about the SPOF is that you prefer distributed state inside the individual services over having events stored in the message bus? Then you're back to high coupling between the inventory manager and notifier, if the former is down the latter won't be able to send out any notifications.
The coupling that should be eliminated is the reverse, ie., the inventory being unable to update stock if the notifier is down, which the article claimed was inevitable using REST. I tried to show it isn't.
Regarding the message bus, I actually meant the broker, which is the SPOF being introduced in the proposed architecture.
Re: Is REST Best in a Microservices Architecture?
#39[0] http://writings.quilt.org/2014/05/12/distributed-systems-and...