Edge server

When building a system with many microservices, sometimes you want to let external clients access only certain services (like a mobile app or web front-end), while keeping other services private inside your system. You also want to protect your services from malicious users who might try to abuse them. This is where the Edge Server pattern comes in.

The Problem

Without a proper solution, internal services could be accessed directly, which is risky, and managing security individually for each service is complex.

The Solution

Add an Edge Server to your system. This acts as a gateway for all incoming requests:

Essentially, the Edge Server behaves like a reverse proxy with security features.

Solution Requirements

img2

Explanation of the diagram:

Key Points

Edge Server vs API Gateway

Although they are related, an Edge Server and an API Gateway are not exactly the same. Here’s the difference

1) API Gateway - Definition: A server that sits in front of microservices and routes client API requests to the right service. - Main responsibilities: - Request routing - Request aggregation (combine responses from multiple services) - Protocol translation (HTTP ↔ gRPC) - Authentication and authorization - Example: A mobile app calls /getBookDetails. The API Gateway forwards this request to Catalog Service and might also call Recommendation Service to combine results.

  1. Edge Server
    • Definition: A server at the edge of the network, physically close to end-users.
    • Main responsibilities:
      • Reduce latency and improve speed
      • Cache frequently accessed content
      • Run computations near the user (edge computing)
      • Protect backend services from malicious traffic
    • Example: Netflix serves a popular show from an edge server near your city, instead of fetching it from the U.S. every time.

Key Differences:

Feature API Gateway Edge Server
Main goal Route API calls, security Reduce latency, caching, edge computing
Location Close to microservices Close to end-users
Handles API requests, auth, aggregation Content caching, local computation
Use in microservices Required in many architectures Optional for performance & bandwidth
Example Kong, AWS API Gateway Cloudflare, Akamai Edge Servers

Here’s a diagram showing how they can work together:

img3

Explanation:

Summary: