Re: publish/subscribe data between services

From: Patrick Mahoney <>
Date: Mon, 07 Mar 2016 20:41:14 -0600

On 2016-03-07 7:41 pm, Buck Evan wrote:

> How do services become aware of each others' port numbers?
> ...
> I've also considered plopping data into an envdir
> ...
> The system I'm replacing solves this by assigning a particular
> localhost IP
> to the whole playground, then we may hard-code the port numbers
> throughout
> the code base. There's complexity in maintaining the state of assigned
> localhost IPs that I'd like to factor out.

Not sure if this would be simpler than IP-per-playground, but you
could look into Linux's network namespaces [1] to assign
netns-per-playground. Within the netns, you can use statically known
ports, and you can use `ip netns exec $namespace command...` to run
arbitrary commands within the namespace. There's a fair amount of
config to properly create the loopback address within each netns, and
possibly allow routing through the primary netns (the one attached to
the LAN) if that's needed.


How common is service restart expected to be? What about a two-layered
supervision tree? Toplevel has one supervisor-per-playground. Second
level supervises the services in each single playground. These
services share a common ./finish script, which kills the whole second
level supervision tree, resulting in the entire playground exiting
when any single service exits. Then the toplevel supervisor restarts
the playground, and you have well-defined places to remove and
re-create the envdir.

Patrick Mahoney <>
Received on Tue Mar 08 2016 - 02:41:14 UTC

This archive was generated by hypermail 2.3.0 : Sun May 09 2021 - 19:44:19 UTC