Skip to content
SEE Exam Prep

Question 4 of 11 · PYQ 2025 · 6 marks

Open in ChatGPT

Describe the process and challenges of implementing Attribute-Based Naming.


Introduction

Flat and structured naming both assume the client knows the name. Attribute-based naming starts from the opposite end: the client knows only what the entity is: its properties: and asks a directory to find it.

The process

  1. Register: an entity publishes its attributes (type, location, capacity, status) to a directory service.
  2. Query: a client sends a predicate over those attributes: "a colour printer, floor 3, idle".
  3. Search: the directory returns the set of entities whose attributes satisfy the predicate.
  4. Select and resolve: the client picks one and resolves its name to an address, or the directory returns the address directly.
  5. Update: entries expire or are refreshed by heartbeats, so a dead entity stops being found.

The directory is usually a distributed database with an index on each attribute, and queries may be combined with ranges, comparisons and boolean operators.

Challenges

  1. Attribute schema. Who decides that the attribute is called printerColour and not colour? Without a shared schema, two services describe the same thing differently and the search misses it.
  2. Scale of the index. Every attribute needs an index that can be searched and updated at the rate of heartbeats; a global directory is a bottleneck.
  3. Naming collisions. Attributes identify a set, not one object, so results must be ranked or filtered by the client.
  4. Staleness. Registrations go stale when a node crashes; the directory needs leases, heartbeat expiry and a consistent view of what is alive.
  5. Security. Anyone can publish attributes, so a client needs to know which entries it can trust: spoofing a service entry is an attack.
  6. Query cost. A broad predicate can return thousands of entries, so results must be paginated and ranked.

Example

Service discovery in a microservice cluster: a service registers {name: payment, version: 2, zone: ap-south-1, status: healthy} in a registry such as Consul. A client asks for name=payment AND version>=2 AND status=healthy and gets the healthy instances, instead of holding a fixed list of addresses.

Conclusion

Attribute-based naming decouples what a client wants from where it is, and pays for that with a schema to agree on, an index to maintain, and leases to expire. It is the naming scheme of service discovery, which is exactly the problem it solves best.