Skip to main content

Version: 3.2.16.5

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 enabled, API7 Enterprise Edition 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.
info

Make sure your API backend has already implemented the endpoints for health checks before enabling it.

  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. From the dialog box, do the following:
  • In the Probe Scheme field, choose HTTP.
  • In the HTTP Probe Path field, enter /health.
  • Use the default value for the rest of the fields.
  • Click Enable.

Additional Resource


API7.ai Logo

API Management for Modern Architectures with Edge, API Gateway, Kubernetes, and Service Mesh.

Product

API7 Cloud

SOC2 Type IIISO 27001HIPAAGDPRRed Herring

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

Apache Software Foundation