[zeromq-dev] RFC: Locating 0mq services

Martin Sustrik sustrik at 250bpm.com
Tue Jan 26 17:24:04 CET 2010


One interesting caveat I've heard was how likely is it for developers to 
have write access to the DNS database, especially in corporate environment?

Martin

Martin Lucina wrote:
> Hi all,
> 
> those of you who have used 0mq 1.x will know that it came with a
> "zmq_locator" daemon that could be used to locate resources using symbolic
> names. Over the last week or so I've been discussing some ideas with Martin
> Sustrik and Palo Malosek about how to cheaply (in terms of development
> time) get this functionality for 0mq 2. Here are the two most interesting
> proposals:
> 
> 1) Using DNS TXT records to locate services:
> 
> This could be implemented in a quite straightforward way as follows:
> 
> - Implement a new "transport" called 'locator' which would use URIs with
>   the syntax 'locator://service.name'.
> 
> - When used with zmq_bind() or zmq_connect() the transport would look up
>   the TXT record for 'service.name' in the DNS. The TXT record data would
>   contain the actual URL to use (e.g. tcp://hostname:port) which would then
>   be resolved using the existing code.
> 
> - In future, multiple TXT records for a single service name could be used
>   to implement e.g. round robin connection to multiple servers or failover.
> 
> Implementation notes:
> 
> This would require using the appropriate system-dependent resolver API,
> which would mean at least separate code for Win32 (using the DNS API at
> http://msdn.microsoft.com/en-us/library/ms682100(VS.85).aspx) and *NIX
> systems (using resolver(3)).
> 
> Note that the 'dns' transport would have to be optional for systems which
> do not provide/for which we don't yet implement the DNS resolver.
> 
> 2) Using a simple static file:
> 
> This option would be useful for those users who don't want to or can't
> change their DNS infrastructure. Rather than implementing a service similar
> to zmq_locator in 1.x we'd use a simple file.
> 
> The easiest way to implement this would be to define an environment
> variable such as ZMQ_LOCATOR. The user would set this to point to an XML
> configuration file which would be loaded at zmq_init() time and could look
> something like this:
> 
> <locator>
>   <service name = "feed1">
>     <connect addr = "tcp://10.10.10.1:5555" />
>     <!-- for failover -->
>     <connect addr = "tcp://10.10.11.1:5555" />
>     <!-- for services binding to this name as opposed to connecting -->
>     <bind addr = "tcp://eth0:5555" />
>   </service>
> </locator>
> 
> Again, the same 'locator://service.name' syntax would be used. The
> 'locator' transport would first look up the service in the ZMQ_LOCATOR
> file if present and then DNS (also if present/configured).
> 
> Both of the options I describe are very low cost to implement and do not
> add any additional third party dependencies to 0mq.
> 
> Thoughts?
> 
> -mato
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev




More information about the zeromq-dev mailing list