Why bother with service discovery when message oriented middleware does the job?
Asked Answered
S

2

23

I get the problem that etcd/consul/$whatever are trying to solve. Service consumers need to talk to service providers, a hugely fluid distributed system needs a mechanism to marry the two.

However, the problem of "where do service consumers go with their requests?" is old and IMO has been solved with MOM -- message oriented middleware.

In MOM, the idea is that service consumers do not care where the service providers live. They simply send a message and have the messaging bus take care of routing the message to the appropriate consumer. There can be multiple providers all doing the same thing (queue-based round-robin) or versioned providers (/v1/request goes to one, /v2/request goes to another).

This is a simple, powerful integration pattern that completely decouples a service interface from its implementation.

And yet I see this bizarre obsession with discovering service providers, which appears to create tight coupling between consumers and providers (in addition to a few other anti-patterns as well.)

So, what am I missing here? TIA.

Siskind answered 15/2, 2015 at 4:25 Comment(1)
I have the same confusion. Most of the examples of both service discovery and resiliency techniques (like circuit breaker and retries) assume synchronous communication between services...Climate
P
3

In MOM, everything flows through the bus, so it might become a bottleneck. With service discovery, a consumer looks up a producer "once" (ok it might have to check back again after a while), and then "directly" (ok could be through a proxy) talks to it.

Or if you prefer catchy phrases: smart endpoints & dumb pipes vs (i guess) dumb endpoints & smart pipes.

Popelka answered 22/7, 2015 at 6:43 Comment(0)
A
3

Personally I don't see the two as either or for this type of architecture. You could use the service discovery to see what services are available at the moment and subscribe to the MOM for the events you then know will be there. If you can't find services you depend on you can raise an alert. Not all MOM's let you know when there is no publisher for a channel.

You can also combine them in the way that the service discovery is where you find the services you want to contact directly, for example a data store that does no job, and still use the MOM to subscribe to events for changes that other systems do. Not all use cases fit well with job queuing either, as some tasks must be solved synchronously, and then the service discovery is a great way to have a dynamic environment.

I do prefer the asynchronous MQ myself, and I think that if you do it right, with load balancing, redundancy, clustering with separate readers and writers etc you can easily have great stability, scalability and a standardized way for all your components to communicate.

Alanna answered 21/9, 2015 at 21:25 Comment(1)
One use case example is if you have multiple message bus (for different message type) and you are building a centralized message dispatcher. The service registry can be used to add or remove message bus dynamicallyMoya

© 2022 - 2024 — McMap. All rights reserved.