Skip to content

soulbird/apisix-seed

 
 

Repository files navigation

APISIX-Seed for Apache APISIX

Go Report Card Build Status Codecov

Do service discovery for Apache APISIX on the Control Plane.

What's APISIX-Seed

Apache APISIX is a dynamic, real-time, high-performance API gateway.

In terms of architecture design, Apache APISIX is divided into two parts: data plane and control plane. The data plane is Apache APISIX itself, which is the component of the traffic proxy and offers many full-featured plugins covering areas such as authentication, security, traffic control, serverless, analytics & monitoring, transformation and logging. The control plane is mainly used to manage routing, and implement the configuration center through etcd.

For cloud-native gateways, it is necessary to dynamically obtain the latest service instance information (service discovery) through the service registry. Currently, Apache APISIX already supports service discovery in the data plane.

This project is a component of Apache APISIX to implement service discovery in the control plane. It supports cluster deployment. At present, we have supported zookeeper and nacos. We will also support more service registries.

The following figure is the topology diagram of APISIX-Seed deployment.

apisix-seed overview

Why APISIX-Seed

  • Network topology becomes simpler

APISIX does not need to maintain a network connection with each registry, and only needs to pay attention to the configuration information in etcd. This will greatly simplify the network topology.

  • Total data volume about upstream service becomes smaller

Due to the characteristics of the registry, APISIX may store the full amount of registry service data in the worker, such as consul_kv. By introducing APISIX-Seed, each process of APISIX will not need to additionally cache upstream service-related information.

  • Easier to manage

Service discovery configuration needs to be configured once per APISIX instance. By introducing APISIX-Seed, Apache APISIX will be indifferent to the configuration changes of the service registry.

How it works

APISIX-Seed completes data exchange by observing changes in etcd and service registry at the same time.

As shown in the above architecture diagram, the workflow of APISIX-Seed is as follows:

  1. Register an upstream with APISIX and specify the service discovery type. APISIX-Seed will watch APISIX resource changes in etcd, filter discovery types, and obtain service names.

  2. APISIX-Seed subscribes the specified service name to the service registry to obtain changes to the corresponding service.

  3. After registering the service with the service registry, APISIX-Seed will obtain the new service information and write the updated service node into etcd.

  4. When the corresponding resources in etcd change, APISIX worker will refresh the latest service node information to memory.

It should be noted that after the introduction of APISIX-Seed, if the service of the registry changes frequently, the data in etcd will also change frequently.

The multi-version concurrency control data model in etcd keeps an exact history of the keyspace.

So, it is best to set the --auto-compaction option when starting etcd to compress the history periodically to avoid etcd eventually eventually exhaust its storage space.

Supported service registry

About

Do service discovery on the CP side

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 98.6%
  • Other 1.4%