At present, the connection between the Manager API and etcd still follows the habit of the etcd v2 version, creating a watch connection for each resource, which will generate a large number of connections.
Purpose
Reduce connections between Manager API and etcd, to reduce the load on etcd services.
Proposal
In the Generic Store, each resource still manages its own cache separately, but no longer connects directly to etcd. Added a unified method of listing full data and watching changes, and the obtained data is uniformly distributed to the Store instances of each resource.
After optimization, the workflow of Generic Store initialization is as follows:
Create a resource prefix mapping table
Initialize each resource Store object and register itself in the resource prefix mapping table
Read the full amount of data, find the corresponding resource according to the key prefix, and distribute the data to the Store object of each resource
Watch the etcd prefix configured in conf.yaml, when obtaining the changed data, find the corresponding resource according to the key prefix, and distribute the data to the Store object of the resource.
The current connections between Manager API and etcd:
After optimization, the connections between Manager API and etcd:
Further action
Reduce connections between Apache APISIX and etcd (a new proposal is needed)
Background
At present, the connection between the Manager API and etcd still follows the habit of the etcd v2 version, creating a watch connection for each resource, which will generate a large number of connections.
Purpose
Reduce connections between Manager API and etcd, to reduce the load on etcd services.
Proposal
In the
Generic Store
, each resource still manages its own cache separately, but no longer connects directly to etcd. Added a unified method of listing full data and watching changes, and the obtained data is uniformly distributed to the Store instances of each resource. After optimization, the workflow ofGeneric Store
initialization is as follows:conf.yaml
, when obtaining the changed data, find the corresponding resource according to the key prefix, and distribute the data to the Store object of the resource.The current connections between Manager API and etcd:
After optimization, the connections between Manager API and etcd:
Further action Reduce connections between Apache APISIX and etcd (a new proposal is needed)