Communication & APIs

Communication and APIs define how applications, services, partners, devices, and users exchange information. Effective communication strategies balance performance, reliability, scalability, security, and ease of integration while enabling systems to evolve independently.

Overview

Modern systems rarely operate as a single application. Business capabilities are typically distributed across APIs, services, databases, third-party providers, mobile applications, web applications, and external partners.

Architects frequently face questions such as:

How should services communicate?
How should external consumers access the platform?
How do APIs evolve safely?
How should failures be handled?
How can communication remain reliable as systems scale?

Communication architecture determines how information flows between systems and directly influences performance, reliability, scalability, security, and user experience.

Key Insight:
Communication is not about protocols. Communication is about moving information between systems efficiently, reliably, and safely.

A Running Example

Consider a healthcare diagnostics platform composed of multiple business services.

Patient Service
Order Service
Billing Service
Notification Service
Search Service

A clinician places a diagnostic order.

Create Order
↓
Validate Patient
↓
Generate Bill
↓
Send Notification

These business capabilities may be implemented by different services owned by different teams.

The challenge becomes determining how these systems communicate while remaining scalable, reliable, and maintainable.

This diagnostics platform will be used throughout the page to demonstrate communication decisions and tradeoffs.

Why Communication Matters

Services provide value only when information can move between them.

Poor communication design often creates:

  • High Latency
  • Coupling Between Services
  • Operational Complexity
  • Availability Risks
  • Scaling Challenges

For example, a diagnostic order may require data from several systems.

Order Service
↓
Patient Service
↓
Billing Service
↓
Notification Service

If communication is poorly designed, a failure in one service may impact the entire workflow.

Communication strategy therefore becomes a core architectural decision rather than a technical implementation detail.

Architect Perspective:
Many scalability and reliability problems originate from communication decisions rather than business logic.

Communication Fundamentals

Before evaluating communication technologies, it is useful to understand several foundational concepts.

Concept Description
Producer System Sending Information
Consumer System Receiving Information
Request Operation Initiated By A Consumer
Response Result Returned By A Provider
Contract Agreement Between Systems
Protocol Communication Mechanism

A typical communication flow looks like:

Consumer
↓
Request
↓
Provider
↓
Response

Although simple in appearance, communication design influences service independence, latency, resiliency, scalability, and long-term maintainability.

Interview Insight:
Most API and communication discussions are ultimately discussions about coupling, reliability, scalability, and ownership.

Synchronous vs Asynchronous Communication

One of the first architectural communication decisions is determining whether a caller should wait for a response or continue processing independently.

Synchronous Communication

In synchronous communication, the caller sends a request and waits for a response.

Client
↓
Request
↓
Service
↓
Response

Examples include API calls between applications and service-to-service requests.

Benefits include:

  • Simple To Understand
  • Immediate Results
  • Easier Debugging
  • Straightforward Error Handling

Tradeoffs include:

  • Higher Coupling
  • Dependency Availability Requirements
  • Increased Latency
  • Potential Cascading Failures

For example, when a clinician submits a diagnostic order, the system may need immediate patient validation before continuing.

Asynchronous Communication

In asynchronous communication, the sender publishes information and continues processing without waiting for an immediate response.

Producer
↓
Message Or Event
↓
Consumer Processes Later

Benefits include:

  • Loose Coupling
  • Higher Scalability
  • Better Resilience
  • Independent Processing

Tradeoffs include:

  • More Operational Complexity
  • Additional Monitoring Requirements
  • Eventual Consistency Considerations
  • More Complex Troubleshooting

An example would be sending patient notifications after an order is created. The order does not need to wait for the notification to be delivered.

Architect Perspective:
The question is rarely whether synchronous or asynchronous communication is better. The question is whether the business process requires an immediate answer.

Choosing The Right Communication Style

Communication style should be selected based on business requirements rather than personal technology preferences.

Scenario Typical Choice
User Login Synchronous
Patient Validation Synchronous
Payment Authorization Synchronous
Notifications Asynchronous
Analytics Processing Asynchronous
Audit Logging Asynchronous

A useful decision framework is:

Does The Caller Need An Immediate Response?
↓
Yes → Synchronous
Can Processing Occur Later?
↓
Yes → Asynchronous

Most enterprise systems use both communication models depending on the business capability being implemented.

Interview Insight:
High-performing architectures rarely use synchronous communication everywhere. They reserve synchronous communication for operations that truly require immediate results.

REST APIs

REST is one of the most common approaches for building APIs and enabling communication between systems.

REST is particularly popular for:

  • Web Applications
  • Mobile Applications
  • Partner Integrations
  • Public APIs
  • Enterprise Service Integration

A typical interaction follows a request-response model.

Client
↓
HTTP Request
↓
REST API
↓
HTTP Response

Benefits include:

  • Widely Understood
  • Strong Ecosystem Support
  • Simple Consumption Model
  • Excellent Browser Support
  • Language Independence

Tradeoffs include:

  • Potential Over-Fetching
  • Potential Under-Fetching
  • Higher Network Overhead
  • Less Efficient Service Communication

For the diagnostics platform, external healthcare partners and mobile applications may consume functionality through REST APIs because interoperability and accessibility are often more important than maximum performance.

Architect Perspective:
REST is often selected because it optimizes interoperability and simplicity rather than raw performance.

gRPC

gRPC is a high-performance communication framework commonly used for internal service-to-service communication.

Unlike traditional REST APIs, gRPC focuses on efficient communication between systems.

Service A
↓
gRPC Call
↓
Service B

gRPC is particularly useful when:

  • Low Latency Is Critical
  • High Throughput Is Required
  • Microservices Communicate Frequently
  • Internal Service Communication Dominates

Benefits include:

  • Excellent Performance
  • Efficient Serialization
  • Strong Contract Definitions
  • Reduced Network Overhead

Tradeoffs include:

  • More Specialized Tooling
  • Less Human Readability
  • Reduced Browser Friendliness
  • Potential Learning Curve

For the diagnostics platform, internal communication between Patient Service, Order Service, and Search Service may use gRPC to reduce latency and improve throughput.

Requirement Typical Choice
Public APIs REST
Browser Consumers REST
Partner Integrations REST
Internal Microservices gRPC
Low-Latency Service Calls gRPC
Architect Perspective:
gRPC is often chosen when the communication happens between services controlled by the same organization and performance becomes a key design requirement.

GraphQL

GraphQL was designed to provide clients with greater flexibility when retrieving data.

Instead of exposing multiple endpoints that return fixed responses, GraphQL allows consumers to request exactly the data they need.

Client
↓
GraphQL Query
↓
GraphQL Service
↓
Requested Data Only

Consider a clinician dashboard displaying patient information.

A REST approach may require multiple requests.

Patient Details Request
Diagnostic History Request
Billing Summary Request

GraphQL can often retrieve the required data through a single query.

Benefits include:

  • Flexible Data Retrieval
  • Reduced Over-Fetching
  • Reduced Under-Fetching
  • Improved Front-End Development Experience

Tradeoffs include:

  • Greater Operational Complexity
  • More Challenging Caching
  • Additional Query Governance Requirements
  • Potential Performance Risks For Poorly Designed Queries

GraphQL is commonly useful when multiple client applications require different views of the same underlying data.

Architect Perspective:
GraphQL solves a data consumption problem rather than a communication performance problem.

Choosing REST vs GraphQL vs gRPC

One of the most common architecture discussions involves selecting the most appropriate communication technology.

Requirement Typical Choice
Public APIs REST
Partner Integrations REST
Browser Applications REST
Internal Microservices gRPC
Low-Latency Service Communication gRPC
Flexible UI Data Requirements GraphQL
Multiple Front-End Clients GraphQL

A useful framework is:

Interoperability First
↓
REST
Performance First
↓
gRPC
Flexible Client Data Retrieval
↓
GraphQL

Large systems frequently use multiple approaches simultaneously.

External APIs → REST
Internal Services → gRPC
Complex UI Experiences → GraphQL
Interview Insight:
Experienced architects rarely ask which technology is best. They ask which technology is best for a specific communication problem.

API Design Principles

Technology selection is only part of API design. The quality of the API contract often matters more than the protocol itself.

Well-designed APIs are:

  • Consistent
  • Predictable
  • Discoverable
  • Maintainable
  • Backward Compatible

Consumers should not need extensive documentation to understand basic API behavior.

Good API design typically includes:

Consistent Naming
Consistent Error Responses
Predictable Request Patterns
Clear Resource Boundaries

Poor API design often results in:

Inconsistent Naming
Unexpected Behaviors
Consumer Confusion
Long-Term Maintenance Problems

API design should prioritize consumer experience rather than implementation convenience.

Architect Perspective:
Consumers interact with the API contract, not the underlying implementation. The contract must be treated as a long-term product.

API Versioning

Business requirements evolve continuously. APIs must evolve without breaking existing consumers.

Consider a patient API.

Version 1
PatientId
Name

A future requirement introduces additional information.

Version 2
PatientId
Name
PreferredLanguage

Existing consumers may still depend on Version 1.

Common versioning approaches include:

Approach Example
URI Versioning /api/v1/patients
URI Versioning /api/v2/patients
Header Versioning Version Specified In Request Headers

Versioning allows APIs to evolve gradually while reducing disruption.

Key considerations include:

  • Backward Compatibility
  • Consumer Migration Strategy
  • Deprecation Policy
  • Support Lifecycle Management
Interview Insight:
Versioning is not a technical challenge. It is a consumer protection strategy that allows systems to evolve safely.

Reliability Patterns

Communication between systems will eventually fail. Networks experience interruptions, services become unavailable, dependencies slow down, and infrastructure occasionally encounters faults.

Architects therefore design communication assuming failures will occur rather than assuming everything will always be healthy.

Timeouts

Requests should not wait forever for a response.

Request Sent
↓
Wait For Response
↓
Timeout Reached
↓
Fail Gracefully

Timeouts prevent resources from being consumed indefinitely while waiting for unavailable services.

Retries

Some failures are temporary and may succeed if attempted again.

Request Fails
↓
Retry
↓
Request Succeeds

Retries should be applied carefully because excessive retries may amplify failures.

Circuit Breakers

Circuit breakers prevent repeated requests from being sent to services that are already failing.

Service Failure Detected
↓
Circuit Opens
↓
Requests Rejected Temporarily

This protects upstream systems and prevents cascading failures.

Fallbacks

Fallbacks provide alternative behavior when dependencies are unavailable.

Primary Service Fails
↓
Fallback Response Returned

Examples may include cached data, default values, or degraded functionality.

Architect Perspective:
Reliable communication is not achieved by preventing failures. Reliable communication is achieved by handling failures predictably.

Idempotency

Distributed communication often involves retries. Retried requests introduce the risk of the same operation being executed multiple times.

Consider a billing request.

Create Payment
↓
Response Lost
↓
Client Retries Request

Without safeguards, the payment may be processed multiple times.

Payment Request #123
↓
Already Processed
↓
Return Previous Result

Idempotency allows repeated requests to produce the same business outcome.

Common use cases include:

  • Payments
  • Order Creation
  • Inventory Updates
  • Background Processing

Idempotency becomes especially important when retries are introduced.

Interview Insight:
Retries solve temporary failures. Idempotency prevents retries from creating duplicate business actions.

API Security

Every API exposes functionality and data that must be protected appropriately.

Security should be considered a fundamental communication requirement rather than an afterthought.

Key security concerns include:

Area Purpose
Authentication Verify Identity
Authorization Control Access
Encryption Protect Data In Transit
Rate Limiting Prevent Abuse

For the diagnostics platform:

Clinician Authenticated
↓
Access Request Evaluated
↓
Authorized Resources Returned

Security requirements frequently influence overall API architecture and communication design.

Architect Perspective:
An API is only as secure as its weakest exposed endpoint.

API Gateway Pattern

As systems grow, exposing every service directly to consumers can become difficult to manage.

An API Gateway provides a centralized entry point.

Clients
↓
API Gateway
↓
Patient Service
Order Service
Billing Service
Notification Service

The gateway typically handles:

  • Routing
  • Authentication
  • Authorization
  • Monitoring
  • Rate Limiting
  • Request Aggregation

Benefits include:

  • Centralized Governance
  • Simplified Client Access
  • Consistent Security Enforcement
  • Improved Observability

Tradeoffs include:

  • Additional Infrastructure
  • Potential Bottleneck
  • Additional Operational Complexity
Architect Perspective:
API Gateways help shield consumers from internal architectural complexity.

Service Discovery

In modern distributed systems, service locations may change frequently as systems scale, restart, fail over, or relocate.

Hardcoding service locations often becomes impractical.

Service A
↓
Discovery Mechanism
↓
Service B Location Returned

Service discovery enables systems to locate one another dynamically.

Benefits include:

  • Improved Scalability
  • Reduced Configuration Management
  • Better Operational Flexibility
  • Simplified Service Mobility

As the diagnostics platform grows from a handful of services to hundreds of services, discovery mechanisms help maintain reliable communication without continuously updating service endpoints.

Architect Perspective:
As microservice environments grow, finding services reliably becomes as important as communicating with them.

Communication Failure Scenarios

Communication failures are inevitable in distributed systems. The goal of architecture is not preventing all failures, but ensuring the system behaves predictably when failures occur.

Request Timeout

A service may fail to respond within an acceptable time window.

Request Sent
↓
Dependency Slow
↓
Timeout Reached

Architects must decide whether to retry, fallback, fail gracefully, or continue with degraded functionality.

Dependency Failure

A downstream system may become unavailable.

Order Service
↓
Calls Billing Service
↓
Billing Unavailable

Without appropriate safeguards, a single failure may cascade across multiple services.

Retry Storms

Retries can help recover from transient failures, but excessive retries can make problems worse.

Service Slowdown
↓
Thousands Of Clients Retry
↓
Additional Load Created

Retry policies should be designed carefully to avoid amplifying failures.

Duplicate Requests

Network failures may leave clients uncertain whether a request succeeded.

Request Processed
↓
Response Lost
↓
Request Retried

Idempotency helps ensure duplicate requests do not produce duplicate business outcomes.

Architect Perspective:
Systems are often judged by their behavior during failure rather than their behavior during normal operation.

Choosing The Right Communication Strategy

Communication decisions should be driven by business requirements rather than technology trends.

Requirement Typical Choice
External Consumers REST
Low-Latency Internal Communication gRPC
Flexible Front-End Queries GraphQL
Immediate Response Required Synchronous
Background Processing Asynchronous

A practical decision framework is:

Who Is Consuming The API?
↓
What Latency Is Acceptable?
↓
How Frequently Will It Be Called?
↓
What Happens When It Fails?
↓
Choose Communication Approach

Communication architecture is ultimately a balancing exercise between simplicity, performance, flexibility, scalability, and operational complexity.

Interview Insight:
The best communication strategy is the one that satisfies business requirements while minimizing unnecessary complexity.

Real-World Case Study

Consider the healthcare diagnostics platform supporting hospitals, clinicians, laboratories, patients, and external healthcare partners.

The platform consists of multiple independently deployed services.

Patient Service
Order Service
Billing Service
Notification Service
Search Service

The architecture team selected different communication approaches based on business requirements.

Capability Approach
External Integrations REST APIs
Internal Service Calls gRPC
Clinician Dashboard Data GraphQL
Notifications Asynchronous Processing
Security Enforcement API Gateway

Additional safeguards included:

  • Request Timeouts
  • Retry Policies
  • API Versioning
  • Authentication & Authorization Controls
  • Idempotency For Critical Operations

The result was a communication architecture that balanced interoperability, performance, flexibility, and reliability while allowing services to evolve independently.

Architect Perspective:
Successful communication architectures rarely rely on a single technology. They combine multiple approaches to address different requirements.

Communication & APIs Review Checklist

The following checklist can be used during architecture reviews and solution design discussions.

✅ Communication Style Selected
✅ Consumer Types Identified
✅ Protocol Chosen
✅ API Contract Defined
✅ Versioning Strategy Defined
✅ Authentication Implemented
✅ Authorization Requirements Defined
✅ Timeouts Configured
✅ Retry Policies Defined
✅ Idempotency Evaluated
✅ Gateway Requirements Assessed
✅ Failure Scenarios Reviewed
✅ Monitoring & Observability Planned

Communication & APIs Canvas

The Communication & APIs Canvas provides a concise summary of architectural decisions.

Area Example
External API Style REST
Internal Communication gRPC
Communication Model Synchronous
Gateway Enabled
Authentication OAuth 2.0
Versioning Strategy URI Versioning
Timeout Policy 3 Seconds
Retry Policy Exponential Backoff
Idempotency Required
Primary Risk Dependency Failure

Common API Anti-Patterns

Synchronous Everything

Making every interaction synchronous increases coupling, latency, and availability dependencies across the entire platform.

No Versioning Strategy

API changes without versioning frequently break consumers and create migration challenges.

No Timeouts

Requests that wait indefinitely can exhaust resources and create cascading failures.

Chatty APIs

Requiring many small API calls to complete a single business operation increases latency and network overhead.

Leaking Internal Contracts

Exposing internal implementation details directly to external consumers creates long-term coupling and limits architectural flexibility.

Inconsistent API Design

Different naming conventions, inconsistent error responses, and unpredictable behaviors increase consumer complexity.

Ignoring Idempotency

Retries without idempotency may create duplicate payments, duplicate orders, and inconsistent business outcomes.

Architect Perspective:
Bad APIs often become long-term architectural liabilities because contracts are much harder to change than implementations.

How Concepts Connect

Communication and APIs influence many other architectural domains.

Business Requirements
↓
Workloads & Interactions
↓
Communication Strategy
↓
Performance & Scalability
↓
Reliability & Resilience
↓
Security & Governance
↓
User Experience

As systems become larger and more distributed, communication architecture becomes increasingly important because every business capability depends on information moving between components.

Key Takeaway

Communication is not about REST, GraphQL, or gRPC.

Those are implementation choices.

The real challenge is determining how systems exchange information reliably, securely, and efficiently.

Successful APIs are easy to understand, easy to evolve, and resilient when failures occur.

Strong communication architectures balance performance, reliability, security, scalability, maintainability, and consumer experience.

The role of an architect is not to choose the newest communication technology.

The role of an architect is to select the communication approach that best supports business goals while minimizing operational complexity and long-term risk.