Skip to main content
Version: 0.8.x

API Account Orchestration

Overview

API Account Orchestration, which can be also called Account Load Balancing helps optimize performance by distributing the API calls among multiple accounts, reducing the load on each individual account. This can prevent performance bottlenecks and ensure that each API account operates within its capacity limits, resulting in improved response times and better overall performance for your application.

Configuration

/etc/lunar-proxy/policies.yaml
global:
remedies:
- name: Global API Account Orchestration
enabled: true
config:
account_orchestration:
round_robin:
- <account_identifier1>
- <account_identifier2>

accounts:
<account_identifier1>: # This can be any string, but it must be unique
tokens:
- header:
name: <header_name>
value: <header_value1>
<account_identifier2>: # This can be any string, but it must be unique
tokens:
- header:
name: <header_name>
value: <header_value2>

The following configuration options are available for this remediation plugin:

ParameterExample ValuePossible ValuesDescription
Load Balancing Methodround_robinOnly round_robin is supported at this timeThe load balancing method to use.
round_robin[account1, account2, account3]List of accounts defined in the accounts sectionThe list of accounts to use for the round robin orchestration method.

The accounts section is required for this plugin to work. It is used to define the accounts that will be used for the account orchestration method. The following configuration options are available for the accounts section:

ParameterExample ValuePossible ValuesDescription
account_identifieraccount1Any stringThe identifier for the account. This can be any string, but it must be unique.
tokensList of tokensList of tokensThe list of tokens to use for the account.
headerHeader name and valueAny header name and valueThe header to use to authenticate with the API provider.
nameAuthorizationAny header nameThe name of the header to use to authenticate with the API provider.
valueBearer 123Any header valueThe value of the header to use to authenticate with the API provider.

Example

/etc/lunar-proxy/policies.yaml
endpoints:
- url: api.com/resource/{id}
method: GET
remedies:
- name: api.com API Account Orchestration
enabled: true
config:
account_orchestration:
round_robin:
- aliceb@comp.io
- johnf@comp.io
- bobc@comp.io

accounts:
aliceb@comp.io:
tokens:
- header:
name: Authorization
value: Bearer 123
johnf@comp.io:
tokens:
- header:
name: Authorization
value: Bearer 456
bobc@comp.io:
tokens:
- header:
name: Authorization
value: Bearer 789

Why use the API Accounts Orchestration plugin?

  • Scalability: By distributing the API calls across multiple API accounts, you can handle a higher volume of requests and achieve better scalability. Load balancing allows you to leverage the resources of multiple API accounts simultaneously, enabling your application to handle increased traffic without overburdening a single account.

  • Redundancy and Fault Tolerance: Load balancing provides redundancy and fault tolerance by allowing you to distribute the workload across multiple API accounts. If one API account becomes unavailable or experiences issues, the load balancer ensures continuous service availability and minimizes the impact of failures.

  • Rate Limit Management: Load balancing helps manage rate limits imposed by the API provider. By distributing the requests across multiple accounts, you can distribute the API calls within the rate limits of each individual account. This prevents exceeding the rate limits on a single account, which could lead to throttling or rejection of requests.

note

This feature is relevant only for stateless API providers, where there’s an option to create multiple accounts, consuming the same API provider, and thus increasing the overall API provider’s quota and the user’s systems consumption capacity.