Skip to main content

Version: 3.8.x

Ensure Upstream High Availability

When API7 Gateway sends the API requests to the upstreams, there can be availability and reliability concerns if those upstream systems fail. This guide covers strategies for the high availability of your upstream dependencies.

Prerequisite(s)

  1. Install API7 Enterprise.
  2. Have a running API on the gateway group.

Add Multiple Upstream Nodes

Using multiple upstream nodes protects against single-node failure. Modifications made to upstream nodes in a gateway group will not affect the same service version published to other gateway groups.

  1. Select Published Services of your gateway group from the side navigation bar, then click the service you want to modify, for example, httpbin with version 1.0.0.
  2. Under the published service, select Upstreams from the side navigation bar.
  3. Click Nodes > Add Node.
  4. From the dialog box, do the following:
  • In the Host and Port fields, enter another API Endpoint.
  • In the Weight field, enter 100, the same as the first node.
  • Click Add.

Modify Load Balancing Type

Load balancing distributes network requests across multiple nodes. It is crucial for systems handling high traffic volumes, improving performance, scalability, and reliability.

API7 Gateway supports a variety of load-balancing algorithms:

  • Weighted Round Robin (WRR)
  • Consistent Hash
  • Exponentially Weighted Moving Average (EWMA)
  • Least connection

By default, API7 Gateway supports the WRR algorithm. This algorithm distributes incoming requests over a set of nodes based on their weight in a cyclical pattern.

  1. Select Published Services of your gateway group from the side navigation bar, then click the service you want to modify, for example, httpbin with version 1.0.0.
  2. Under the published service, select Upstreams from the side navigation bar.
  3. In the Upstream Configuration field, click Edit.
  4. From the dialog box, edit Load Balancing Type to Least Connection.
  5. Click Save.

Enable Health Checks

Health checking is a mechanism that determines whether upstream nodes are healthy or unhealthy based on their responsiveness. With health checks configured, API7 Enterprise will only forward requests to upstream nodes that are considered healthy, and not forward requests to the nodes that are considered unhealthy.

There are two general approaches to health checks:

  • Active health checks: determines the health of an upstream node by actively probing the node.
  • Passive health checks: determines the health of an upstream node based on how the node responds to user requests without initiating additional probes. Passive checks must be used with active checks. They cannot be used alone.

API7 Enterprise supports both L7 (HTTPS and HTTP) and L4 (TCP) health checks.

By default, upstream health checks are globally enabled:

config.yaml
apisix:
disable_upstream_healthcheck: false

Follow the following steps to configure the details of health checks.

info

Before proceeding, make sure your API backend has implemented the endpoints for health checks.

  1. Select Published Services of your gateway group from the side navigation bar, then click the service you want to modify, for example, httpbin with version 1.0.0.
  2. Under the published service, select Upstreams from the side navigation bar.
  3. In the Health Check field, click Enable.
  4. Configure Active Health Check and optionally the Passive Health Check.

API7 Enterprise requires the configuration of active health check when using passive health check. When an upstream service becomes unhealthy, the active health check is in place to periodically check if the upstream service has recovered.

See Configure Upstream Health Checks to learn more about configurations and behaviours.

Additional Resource

API7.ai Logo

The digital world is connected by APIs,
API7.ai exists to make APIs more efficient, reliable, and secure.

Sign up for API7 newsletter

Product

API7 Gateway

SOC2 Type IIISO 27001HIPAAGDPRRed Herring

Copyright © APISEVEN PTE. LTD 2019 – 2025. Apache, Apache APISIX, APISIX, and associated open source project names are trademarks of the Apache Software Foundation