DEV Community

Bulat Gabdrakhmanov
Bulat Gabdrakhmanov

Posted on

Microservices 101: Communication between services

Microservice architecture consists of multiple independent services that often need to communicate with each other.

This communication can be achieved in two primary ways:

  • Synchronous
  • Asyncronous

Synchronous communication

Image description

Synchronous communication follows a client-server model, where one service sends a request to another and waits for a response before proceeding.

Common protocols

  • REST APIs – resource-based communication using HTTP methods (GET, POST, PUT, DELETE)
  • RPC - Remote Procedure Call. Allows invoking methods on remote services as if they were local. Examples:

    • SOAP - XML-based
    • gRPC - uses binary format for payloads, high performance,

Pros & Cons

Pros:

  • Simple to use and implement
  • Immediate data retrieval

Cons:

  • Tightly coupled - if one service depends on another that is down, the entire operation fails
  • Scalability issues - high traffic can overload serivces
  • Latency - slow response times can create bottlenecks

Use cases

  • External API calls
  • Need immediate response (e.g. authentication)
  • Data consistency is critical (e.g. order processing)

Asynchronous communication

Image description

Asynchronous communication uses message brokers as an intermediate service for communication between services. Instead of waiting for an immediate response, a service sends a message to a broker, which another service later processes.

Pros & Cons

Pros:

  • Loosely coupled - services operate independently, improving scalability
  • High availability and resilience - a service can continue operating even if other services are temporarily down

Cons:

  • Increased complexity and maintenance - requires additional infrastructure and message handling
  • Messages ordering & duplication - messages may arrive out of order or be duplicated, requiring deduplication strategies

Use cases

  • Event-driven architecture
  • Background processing - immediate response is not required
  • High-load systems - where scalability is a priority

Heroku

Simplify your DevOps and maximize your time.

Since 2007, Heroku has been the go-to platform for developers as it monitors uptime, performance, and infrastructure concerns, allowing you to focus on writing code.

Learn More

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs