Skip to main content

Version: 3.2.9.5

Ensure Upstream High Availability

When API7 Enterprise 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.

Prerequisites

  1. Obtain a user account with Super Admin or API Provider role.
  2. Publish a service.

Add Multiple Upstream Nodes

Using multiple upstream nodes protects against single node failure. According to Service Runtime Configurations, you can change upstream nodes during or after publishing services. Modification made to upstream nodes in a gateway group will not affect the same service version published to other gateway groups.

  1. Select Services from the side navigation bar and then select Swagger Petstore > 1.0.0 on Test Group.
  2. Select Upstreams from the side navigation bar and then click Nodes > Add Node.
  3. From the dialog box, do the following:
    • In the Host and Port fields, enter another API Endpoint.
    • In the Weight field, 100 as the same of the first node.
  4. 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 Enterprise Edition supports a variety of load balancing algorithms:

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

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

The load balance type is not a Service Runtime Configuration, you should modify it in the service template and then publish a new version to the gateway group. It is non-editable in the published versions.

  1. Select Services from the side navigation bar and then select Swagger Petstore.
  2. 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 Edit.
  6. Select Services from the side navigation bar and then click Publish New Version for the Swagger Petstore service.
  7. Choose the Test Group gateway group and then click Next.
  8. From the dialog box, do the following:
    • In the New Version field, enter 1.0.1.
    • Leave the nodes unchanged and then click Publish.

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 check:

  • 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.

Since health check configurations are not considered Service Runtime Configurations, you should modify it in the service template and then publish a new version to the gateway group. It becomes non-editable in the published versions.

info

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

  1. Select Services from the side navigation bar and then select Swagger Petstore.
  2. Select Upstreams from the side navigation bar.
  3. In the Active Health Check field, click Enable.
  4. From the dialog box, do the following:
    • In the Scheme field, choose HTTP.
    • In the HTTP Probe Path field, enter /health.
    • Use default value for the rest of the fields.
    • Click Enable.
  5. In the Passive Health Check field, click Enable.
  6. From the dialog box, do the following:
    • In the Scheme field, choose HTTP.
    • Use default value for the rest of the fields.
    • Click Enable.
  7. Select Services from the side navigation bar and then click Publish New Version for the Swagger Petstore service.
  8. Choose the Test Group gateway group and then click Next.
  9. From the dialog box, do the following:
    • In the New Version field, enter 1.0.1.
    • Leave the nodes unchanged and then click Publish.

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