Part 3 · Blueprint 14
Service Discovery & Service Mesh Architecture
12 min reading · Sources · Editorial review pending
A discovered address can be stale and a secure channel can still reach an unauthorized service.
Page details
Published date · Last edited:
Draft edition. Editorial review and supplementary reading recommendations are still being completed.
Format: Architecture walkthrough. Prerequisites: the beginner bootcamp. Chapter prerequisites: Load Balancing & API Gateways, Monolith vs. Microservices Architecture.
Sixty-second mental model
Problem: A discovered address can be stale and a secure channel can still reach an unauthorized service.
Use: Separate endpoint discovery from identity and traffic policy.
Design boundary: Resolve and secure communication between changing service endpoints. Discovery supplies eligible addresses; a mesh can apply transport identity and traffic policy. Neither decides application authorization or makes retries safe.
Layer 1 · Intuition
Hypothetical scenario: Northwind is designing service discovery and mesh. Maya represents product requirements, Dev implementation and Priya reliability. The team must agree what one endpoint means and which component owns the service identity.
Think of a phonebook plus rules for internal calls. Separate the requester from service identity, then identify the retained evidence needed after failure.
- Authority
- The entitled state owner.
- Invariant
- A rule preserved across concurrency and failures.
Architecture and worked reasoning
Design boundary: Resolve and secure communication between changing service endpoints. Discovery supplies eligible addresses; a mesh can apply transport identity and traffic policy. Neither decides application authorization or makes retries safe.
Responsibilities on the request path
Workload and limiting resource
Hypothetical discovery refresh is every 10 seconds and an endpoint is removed immediately after a client refresh. The client may retain it for almost 10 seconds, plus connection behavior. A 1-second connect timeout with three serial attempts can consume roughly 3 seconds before backoff/other work. Those settings must fit the caller deadline.
Keep the units attached to each intermediate result. The assumptions above describe a hypothetical exercise, not observed vendor capacity. A real capacity decision also needs a measured service curve, skew, recovery traffic and an explicit admission policy for overload.
Mutation or publication path
- Publish an endpoint only after readiness.
- Update endpoint membership as instances start and drain.
- Apply authenticated transport and bounded connection/retry policy.
Observation and recovery path
- Resolve a target using the current endpoint view.
- Handle stale endpoints with safe failure behavior.
- Distinguish transport authentication from permission to the requested tenant/resource.
Failure that changes the decision
Hypothetical scenario: Both application and proxy retry a non-idempotent call. Two retry layers can multiply attempts; assign retry ownership and enforce a total attempt/deadline budget.
Attempt this decision before reading the explanation
Does mutual TLS allow any authenticated service to read any tenant record?
No. It establishes peer identity and protected transport under its trust configuration. The target still needs authorization for the requested resource and operation.
Supporting mechanism analysis
Hypothetical scenario: Northwind. Maya represents product, Dev implementation and Priya reliability. The following workflow develops the underlying mechanism.
Naming the responsibility helps organize the design, but does not yet justify remote communication. Identify the concrete independence the team needs and account for the new dependency.
A module groups responsibilities behind an interface inside a deployment. A separately deployed service exposes an interface across a communication boundary. Both can support clear ownership, but only the second necessarily introduces remote availability, addressing, serialization and deadline concerns into this request path.
The product-record service is already a real boundary in the hypothetical brief. It owns the authoritative record supplied to the catalogue. The catalogue owns how an eligible representation reaches the visitor. A useful API explains the record’s meaning and freshness evidence, not just the spelling of a request field.
HTTP provides request and response semantics. An RPC interface presents named operations whose arguments and results cross a process boundary. Choosing JSON over HTTP or Protocol Buffers with gRPC changes representation and tooling, but neither choice decides who owns the price or what a timeout proves.
Hypothetical scenario. Compare keeping price formatting as a catalogue module with moving it behind a separately deployed formatter. Both consume the same source product revision and market selection. The separate deployment earns its boundary only if independent ownership, release cadence or scaling justifies an additional synchronous failure dependency.
Timeout and cancellation belong in the interface review. The catalogue chooses the remaining allowance and the permitted unavailable result. The formatter stops useful work when cancellation can be honored; cancellation does not retract an independently committed action. If checkout is later introduced, place its spending or reservation invariant at an authoritative transaction boundary rather than asking a display service to enforce it.
At fifteen catalogue reads per second, one product call and one formatting call produce 15 × 2 = 30 downstream calls per second. The formatter receives fifteen of those, not thirty. If the catalogue instead makes three formatting calls per read, formatting demand is 15 × 3 = 45 per second before retries. A small interface design choice can change component demand without changing visitor count.
The selected 35 ms formatter fits inside that allowance, but a fresh 400 ms formatter timeout does not. A caller should constrain downstream waiting by the remaining parent allowance and a suitable return reserve. Real measurements should replace the selected phases and include request dispatch and scheduling that the simplified accounting may omit.
Service discovery maps a logical service identity to reachable destinations. Selection then chooses among suitable candidates. Northwind’s regional proxy handled worker selection; a catalogue worker calling the product service still needs its own way to find and use that service. A resolved address does not establish record correctness or application readiness.
Compatibility belongs in the interface decision too. Adding an optional field is different from changing the meaning of an existing price field. State which clients can encounter which versions and how an older caller behaves. A successful deployment of the server alone does not establish that all callers understood the changed result.
Possible revisions include keeping formatting local, returning an approved simpler representation or providing an independently justified service with explicit failure behavior. Do not silently omit currency or present an ambiguous price as degradation. The product requirement determines which fallback is acceptable; the network architecture must implement that decision.
Northwind’s immediate design keeps price formatting local while retaining the existing product-service contract. The artefact passed forward is an explicit catalogue representation: public product fields, market, currency and version, with no private session data. That makes the next edge-caching question precise: which responses may be reused for which visitors, and for how long?
Layer 3 · Internals
Trade-offs and limits
| Approach | Provides | Requires |
|---|---|---|
| Application networking library | Keeps policy close to the application runtime. | Updates and language support may be distributed across services. |
| Shared proxy data plane | Can centralize transport policy across languages. | Control-plane availability, configuration convergence and proxy capacity require operation. |
Recovery decision
Hypothetical scenario: Both application and proxy retry a non-idempotent call. Two retry layers can multiply attempts; assign retry ownership and enforce a total attempt/deadline budget.
No. It establishes peer identity and protected transport under its trust configuration. The target still needs authorization for the requested resource and operation.
Write your design before revealing the review
Does mutual TLS allow any authenticated service to read any tenant record?
Drafts and self-review are stored only in this browser. They are separate from reading completion.
Compare your decision
No. It establishes peer identity and protected transport under its trust configuration. The target still needs authorization for the requested resource and operation.
Both application and proxy retry a non-idempotent call. Two retry layers can multiply attempts; assign retry ownership and enforce a total attempt/deadline budget.
Check your understanding
Does mutual TLS allow any authenticated service to read any tenant record?
No. It establishes peer identity and protected transport under its trust configuration. The target still needs authorization for the requested resource and operation.
How would you recover from this failure: Both application and proxy retry a non-idempotent call. Two retry layers can multiply attempts; assign retry ownership and enforce a total attempt/deadline budget.
Start with the exact boundary that failed. Publish an endpoint only after readiness. Update endpoint membership as instances start and drain. Apply authenticated transport and bounded connection/retry policy. Then recover evidence through the observation path: Resolve a target using the current endpoint view. Handle stale endpoints with safe failure behavior. Distinguish transport authentication from permission to the requested tenant/resource. Preserve the distinction between a confirmed state change and an unavailable response.
Which assumption in the worked calculation would a burst or concentrated tenant invalidate first?
Hypothetical discovery refresh is every 10 seconds and an endpoint is removed immediately after a client refresh. The client may retain it for almost 10 seconds, plus connection behavior. A 1-second connect timeout with three serial attempts can consume roughly 3 seconds before backoff/other work. Those settings must fit the caller deadline. Recompute the affected resource rather than multiplying unrelated storage and network budgets by the same factor. Resolve and secure communication between changing service endpoints. Discovery supplies eligible addresses; a mesh can apply transport identity and traffic policy. Neither decides application authorization or makes retries safe.
Which component in this topology could be removed from a smaller first deployment?
Service caller, Discovery cache, Proxy policy, Target workload name responsibilities, not a requirement for separate processes. Co-locate responsibilities when their transaction, trust and capacity boundaries permit it. Publish an endpoint only after readiness.
What evidence must a caller have before relying on the observation path?
Resolve a target using the current endpoint view. Handle stale endpoints with safe failure behavior. Distinguish transport authentication from permission to the requested tenant/resource. No. It establishes peer identity and protected transport under its trust configuration. The target still needs authorization for the requested resource and operation.
45-minute interview rubric
- 00–05: scope endpoint and service identity.
- 05–12: identify the limiting resource and derive the domain workload above, retaining units and assumptions.
- 12–28: draw service identity, numbered writes and reads.
- 28–40: challenge recovery: Separate endpoint discovery from identity and traffic policy.
- 40–45: defend service_id placement, observations and remaining assumptions.
Go deeper
- xDS configuration API overview — envoy 1.41.0-dev-a40510 documentation · Primary document · www.envoyproxy.io. Separate endpoint discovery from identity and traffic policy. Verified 2026-10-26.
- Deadlines | gRPC · Primary document · grpc.io. Separate endpoint discovery from identity and traffic policy. Verified 2026-10-26.
- RFC 9110: HTTP Semantics · Primary document · www.rfc-editor.org. Separate endpoint discovery from identity and traffic policy. Verified 2026-10-26.
Decision log
Separate endpoint discovery from identity and traffic policy.
Preserve endpoint identity and service identity ownership.
Revisit changed workload, observations or recovery objectives.