英文:
Add new server to HAProxy using dataplane api with Rate limiting in Golang
问题
我正在通过我的 Golang 代码向 Haproxy 添加新的后端服务器。我可以看到在添加新服务器时有一个名为 max connections 的参数,可以用于限制连接数。还有一个名为 maxqueue 的参数,如果达到最大连接限制,它将排队连接。但是我找不到指定队列超时的选项。而且我在文档中也找不到默认的队列超时时间。
此外,在向后端添加新服务器时,如何基于请求数(滑动窗口)进行速率限制?
我可以看到有一个选项可以提及 stick table,但是我找不到其实现的示例。
英文:
I am adding new backend server to Haproxy through my golang code. I can see there is a parameter called max connections while adding new server which can be used to limit no of connections. There is also a parameter called maxqueue which will queue the connections if max connection limit is reached. But I cant find-out the option to specify the queue timeout. And I could not find from documentation what is default queue timeout time.
Furthermore, How can I add rate limiting based on no of requests (sliding window) while adding new server to backend?
I can see there is an option of mentioning stick table however I could not find example of its implementation.
I am referring to below documentation.
https://www.haproxy.com/documentation/dataplaneapi/community/#post-/services/haproxy/configuration/servers
答案1
得分: 1
一个服务器没有"队列超时"。您可以通过后端配置来设置"队列超时"。
https://www.haproxy.com/documentation/dataplaneapi/community/#post-/services/haproxy/configuration/backends
https://www.haproxy.com/documentation/dataplaneapi/community/#put-/services/haproxy/configuration/backends/-name-
可以通过默认调用来获取默认值。
https://www.haproxy.com/documentation/dataplaneapi/community/#get-/services/haproxy/configuration/defaults
英文:
A server have no "queue timeout". You can set the "queue timeout" via the backend configs
https://www.haproxy.com/documentation/dataplaneapi/community/#post-/services/haproxy/configuration/backends
https://www.haproxy.com/documentation/dataplaneapi/community/#put-/services/haproxy/configuration/backends/-name-
The defaults can be received via the defaults call.
https://www.haproxy.com/documentation/dataplaneapi/community/#get-/services/haproxy/configuration/defaults
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论