conductor icon indicating copy to clipboard operation
conductor copied to clipboard

Design Pattern

Open cheveyo20 opened this issue 9 years ago • 1 comments

Hi what Is better from a Design Point of view. Implement worker which poll their working tasks or design everything as a microservice and a service discovery and let conductor do microservice calls via the system task HTTP.

A very obvious thing Is the second approach would keep the services technology independ to conductor. What about scalability etc. it would also be possible to do workers which perform the service calls... What do you think?

cheveyo20 avatar Nov 01 '17 19:11 cheveyo20

It sounds a lot like you're contemplating between a poll model vs. a push model. If I'm understanding you correctly, you're asking if it would be better for conductor to make HTTP calls to services via system task over letting services poll for a job from conductor. I think the latter is what conductor was designed for.

In my opinion, the poll model works better. In my implementation, I have conductor instances behind a single ELB, and all services (workers) poll from the ELB. The downfall of this is the need to implement the conductor-client in your service code, but the Netflix team has done a good job of keeping the amount of custom changes minimal. On top of that, we also externalized a config to enable or disable conductor polling so that if we wanted standalone instance of a service, we can turn conductor polling off. The upside is that conductors and services remain completely stateless, and to scale, we can just spin up more worker instances that will immediately begin polling from the conductor ELB. Since conductor does not care if it's being polled by 0 workers or 1000 workers and where those workers are, it's a robust solution to scaling. You can easily attach your services to AWS auto-scaling group or containerize your services with Kubernetes to scale up as needed, as long as they are configured to point to the conductor ELB.

The flip side, which is conductor making calls to some discovery service to send jobs to worker instances raises more questions that could make the conductor implementation more complex than necessary. How will conductor keep track of the living worker instances and which instance is working on a job and which is available in order to send jobs? Will you implement some queue like Kafka in the middle for conductor to push messages to and have available service pick up the next job (which sounds like an alternative to Dyno-queues)? The services would only need open APIs and not a conductor client implementation, but the amount of work to design a service discovery mechanism may add more work.

Not sure if you were asking a generic question over two designs or if you were asking specifically about conductor and which implementation may be better for it, but if you're just curious about generic design principles, I would recommend researching micro-service orchestration design vs. choreographic design.

sungsk avatar Feb 08 '18 16:02 sungsk