📗
Janus Manual
  • Introduction
  • Installation
    • Docker
  • Quick Start
    • Authenticating
    • Add an endpoint
    • Modify (Update/Delete) an endpoint
    • Add Plugins
    • Authentication
    • Adding your API - File System
  • Clustering/HA
  • Proxy Reference
    • Terminology
    • Overview
    • Routing capabilities
    • Load Balacing
    • Request Host header
      • Using wildcard hostnames
      • The preserve_host property
    • Request URI
      • The strip_path property
      • The append_path property
    • Request HTTP method
    • Routing priorities
    • Conclusion
  • Plugins
    • Basic
    • Organization
    • Body Limit
    • Circuit Breaker
    • Compression
    • CORS
    • OAuth
    • Rate Limit
    • Request Transformer
    • Response Transformer
    • Retry
  • Auth
    • OAuth 2.0
  • Misc
    • Health Checks
    • Monitoring
    • Tracing
  • Known Issues
    • Stale HTTP Keep-Alive
  • Upgrade Notes
    • 2.x to 3.x
    • 3.6.x to 3.7.x
Powered by GitBook
On this page
  • Round Robin
  • Weight

Was this helpful?

  1. Proxy Reference

Load Balacing

Janus provides multiple ways of load balancing requests to multiple backend services: a roundrobin (or just rr) method, and a weight method.

Round Robin

{
    "name": "My API",
    "proxy": {
        "listen_path": "/foo/*",
        "upstreams" : {
            "balancing": "rr",
            "targets": [
                {"target": "http://my-api1.com"},
                {"target": "http://my-api2.com"},
                {"target": "http://my-api3.com"}
            ]
        },
        "methods": ["GET"]
    }
}

This configuration will apply the roundrobin algorithm and balance the requests to your upstreams.

Weight

{
    "name": "My API",
    "proxy": {
        "listen_path": "/foo/*",
        "upstreams" : {
            "balancing": "weight",
            "targets": [
                {"target": "http://my-api1.com", "weight": 30},
                {"target": "http://my-api2.com", "weight": 10},
                {"target": "http://my-api3.com", "weight": 60}
            ]
        },
        "methods": ["GET"]
    }
}

This configuration will apply the weight algorithm and balance the requests to your upstreams.

PreviousRouting capabilitiesNextRequest Host header

Last updated 4 years ago

Was this helpful?