Skip to content

feat: As a user, I want the consul plug-in to call the serviceID of the health api for deduplication. #10882

Description

@theweakgod

Description

According to member blake of consul, the best way to implement consul is to register it on each node, but apisix starts from the api: v1/health/checks/ takes serviceID to get the data of each node, so there will be duplicate data here, for example

[{"Node":"consul-01","CheckID":"service:192.168.11.2:8001","Name":"Service 'test' check","Status":"passing","Notes": "","Output":"TCP connect 192.168.11.2:8001: Success","ServiceID":"192.168.11.2:8001","ServiceName":"test","ServiceTags":[],"Type": "tcp","Interval":"5s","Timeout":"5s","ExposedPort":0,"Definition":{},"CreateIndex":12014,"ModifyIndex":12015},{"Node" :"consul-03","CheckID":"service:192.168.11.2:8001","Name":"Service 'test' check","Status":"passing","Notes":"","Output ":"TCP connect 192.168.11.2:8001: Success","ServiceID":"192.168.11.2:8001","ServiceName":"test","ServiceTags":[],"Type":"tcp"," Interval":"5s","Timeout":"5s","ExposedPort":0,"Definition":{},"CreateIndex":10366,"ModifyIndex":12020}]

If node A is registered but node B is not, then the serviceID obtained by apisix will not be balanced, and the weight of the serviceID will be offset, but the user does not know it.
So, I want to deduplicate serviceID

By the way, I want to add a scheduling based on the minimum IP load. I still use roundrobin, but when polling the upstream, the polling is based on the minimum IP schedule, because we currently encounter a scenario where one machine has multiple service, but at a certain point in time, many requests hit the machine at the same time, causing the CPU to skyrocket. We hope to design an optional plug-in parameter. If this parameter is selected, the IP will be sorted first, and then the port will be sorted.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status
✅ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions