Search code examples
servicednsservice-discovery

What does a service discovery application solve that couldn't be met by DNS based lookup for a service?


I have happily gotten away with host file entries for smaller setup and DNS based service names for larger setups. Including using search order to construct the full DNS name of the service to lookup. I unclear how service discover can also take up the load balancing problem?


Solution

  • With SRV and TXT records one could construct a perfectly viable service discovery out of DNS. Spotify does exactly this. SRV records are obvious, but not many people realize one can put many application settings in TXT records for some reason. Values can be overridden by values lower down in the tree. It ends up being a lightweight sort of zookeeper, which imitates the DNS structure anyway. More modern service locators have less restrictions on content, and one can store ssl keys (encrypted), configuration snippets, etc. directly in the service locator. A DNS TXT record has a limitation of 255 characters, so it is somewhat limited. If you split the value into separate strings, you can fit up to 64K in a TXT record, but it's somewhat goofy. On the other hand, DNS is very fault tolerant and extremely fast.

    Note: what people talk about "service discovery" they're typically not just talking about strictly that, but also storing endpoints and other settings normally stored in files.