I have two web services, one of which creates resources on disk for the other one to read and process. The resources are subject to irregular change, so I'd like to inform the consumer service when a resource is updated instead of polling and saving the file timestamps or restarting services.
Problem is, I intend to replicate the consumers. With Docker one can compose a set of services and replicate specific services for redundancy or performance. However, those replicas are behind a common address to the outside world and a load balancer decides where to pass a particular request. For my use, each replica would need to be informed as soon as a resource is updated so it can in turn stay up to date. Initial loading and processing is costly so constant reloading is a bad choice.
Is there a way, in Docker, to broadcast or copy a request to all containers of one type? Or simply to every running container?
It really would be a non-issue if it weren't for the masking load balancer... Apparently one can specify a network endpoint_mode
as dsnrr
to get access to a list of container addresses, but using it would to my knowledge involve actually rewriting the balancer, which is less than ideal for this limited case.