Who you gonna call? Google Cloud Platform's beta Service Directory is like a phone book for microservice discovery

Playing catch-up with AWS and not that smart, but some advantages over DNS

Google Cloud Platform's Service Directory, which aims to enhance microservice discovery, has hit beta.

Businesses may have thousands of services running (just ask Monzo, for example) and applications must be able to find and call the endpoints of these services. This discovery role is traditionally performed by DNS, but Google reckons DNS has limitations.

"DNS resolvers can be unreliable in terms of respecting TTLs and caching, cannot handle larger record sizes, and do not offer an easy way to serve metadata to users," Google's docs explain.

Service Directory is a custom directory designed for service lookup. At first glance it is depressingly manual. You create a service by entering a name and endpoint (IP number and port). Each endpoint can also have metadata added, in the form of one more name/value pairs of your own choosing. Metadata can include URLs.

All very simple, and the endpoints do not need to be on GCP but could be on-premises or anywhere on the internet. Service Directory is organised by namespace and GCP region.

Service Directory is an alternative to DNS resolving endpoints

Service Directory is an alternative to DNS for resolving service endpoints

However, the key is that the service has an REST-based API for resolving, creating, deleting and updating service records, subject to permissions. There is also an option to configure a DNS zone to allow queries via DNS, though it looks like you cannot access the metadata this way. Everything can therefore be automated, with services registering and updating their entries in Service Directory and clients using either DNS or the API to retrieve endpoints. All requests to the directory are logged.

Diagram showing how clients might use Service Directory

Diagram showing how clients might use Service Directory

Note that Service Directory is inherently no smarter than DNS. It does not check service health, nor does it know whether the endpoint for a service is actually reachable by a client.

You can roll your own system, though. Google suggests using metadata to record when a service is registered or updated, as well occasionally updating metadata for system health. You could write an application, for example, which checked the health of all the services in the directory and tagged them accordingly.

AWS has a similar service called Cloud Map.

GCP Service Directory is free while in beta and no pricing has yet been detailed. ®

Similar topics

Other stories you might like

Biting the hand that feeds IT © 1998–2021