Menu

Kong Upstreams, Targets, Load Balancing and Health Checks
πŸ“°

Kong Upstreams, Targets, Load Balancing and Health Checks

DEV Community: backendΒ·AnushaPalleΒ·9 days ago
#zojT66jR
#devtobackend#devto#dev#upstream#target
Long article (688 words) β€” no AI summary yet.
Reading 0:00
15s threshold

Meta description: Spread traffic across several backend instances and automatically stop sending requests to failing ones.

What you'll learn

Upstreams and Targets

Kong's load balancing algorithms

Active and passive health checks

How to test failover yourself

Why one backend isn't enough

A single instance of your API is a single point of failure, and it can only handle so much load. In practice you run several copies . Kong needs to know:

How to distribute requests across them (load balancing)

How to avoid the broken ones (health checks)

The concepts

Upstream: a virtual name that stands for a pool of backends.

Target: one real instance in the pool ( host:port ), with a weight .

β”Œβ†’ Target 1: alpha1:8080 Kong β†’ Upstream "alpha-upstream" ─ β””β†’ Target 2: alpha2:8080

Enter fullscreen mode

Exit fullscreen mode

Setting it up

1. Create the upstream

curl -i -X POST http://localhost:8001/upstreams --data name = alpha-upstream

Enter fullscreen mode

Exit fullscreen mode

2.…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.