[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support health check for TCP upstreams #10826

Open
MonkeyDLufy opened this issue Jan 16, 2024 · 9 comments
Open

feat: support health check for TCP upstreams #10826

MonkeyDLufy opened this issue Jan 16, 2024 · 9 comments

Comments

@MonkeyDLufy
Copy link
Contributor

Description

As a tcp server user, I want to use apisix for proxy tcp servers. So I need the stream upstream can support active health check. But I try and found that, the active health check seem only support for http, it can't work on tcp.

@lakshya8066
Copy link
Contributor

Hi @MonkeyDLufy please check the docs here if this is what you are looking for
https://apisix.apache.org/docs/apisix/next/tutorials/health-check/#active-check

Are you having any specific problems in configuring it?

@kayx23 kayx23 changed the title feat: As a user, I want to ..., so that ... feat: support health check for TCP upstreams Jan 16, 2024
@MonkeyDLufy
Copy link
Contributor Author
MonkeyDLufy commented Jan 16, 2024

Hi @MonkeyDLufy please check the docs here if this is what you are looking for https://apisix.apache.org/docs/apisix/next/tutorials/health-check/#active-check

Are you having any specific problems in configuring it?

curl http://127.0.0.1:9180/apisix/admin/stream_routes/1 -X PUT -d ' { "server_port": 9100, "upstream": { "nodes": { "10.178.178.178:80": 1, "10.187.187.187:80": 1 }, "type": "roundrobin", "scheme": "tcp", "checks": { "active": { "type": "tcp", "unhealthy": { "interval": 1, "tcp_failures": 3 }, "healthy": { "interval": 2, "successes": 1 } } } } }'

This is my config. I used tcpdump to capture packets and observed that the probe packets for active health checks were not sent. Among the two IP addresses in the example, one of them is not reachable. I expected it to be circuit broken and not receive any traffic, but apisix still sent traffic to it until the connection timed out and then retried with another available node.

@shreemaan-abhishek
Copy link
Contributor

AFAIK, healthchek for TCP upstreams isn't supported.

@MonkeyDLufy
Copy link
Contributor Author

Thank you for helping me confirm this information. I hope that Apisix can provide support for this feature in the future

@theweakgod
Copy link
Contributor

@shreemaan-abhishek I can handle this issue, can you assign this to me?

@MonkeyDLufy
Copy link
Contributor Author

I think health check for UDP upstreams is also necessary.

@fatihusta
Copy link
Contributor

Hi
I worked on this issue. Stream proxy health check works fine now.
Here is my branch. https://github.com/fatihusta/apisix/tree/stream-proxy-healthcheck-support
@shreemaan-abhishek could you please check my branch. Is this right way to do this or not? Please give me advice. I will send the PR after your review.

@shreemaan-abhishek
Copy link
Contributor
shreemaan-abhishek commented Jul 3, 2024

@fatihusta it would be much better if you write your proposal first.

@fatihusta
Copy link
Contributor

@fatihusta it would be much better if you write your proposal first.

I re-imlemented this PR. Also I added new control API functions.
Control API is in http context. upstream-healthcheck-stream shared-dict is in stream context. There is no access between http and stream context for shared-dicts. So I added unix domain socket in stream context. After that I access the unix socket from control API. Is this right way to do this or not?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 📋 Backlog
Development

No branches or pull requests

5 participants