简体   繁体   English

基于 pod 上可用连接数的 Kubernetes 上的自定义负载均衡器

[英]Custom Load Balancer on Kubernetes based on number of available connections on the pod

There is a system that allows us to establish at most 100 http connections.有一个系统允许我们最多建立 100 个 http 连接。

We have a Spring boot app that connects to that system using a connection pool with a limited size and as request come in, if there are no connections in the pool, the requests waits in a queue for an available connection.我们有一个 Spring 启动应用程序,它使用大小有限的连接池连接到该系统,并且当请求进入时,如果池中没有连接,请求会在队列中等待可用连接。

The app is deployed to Kubernetes, and it scales and round robin requests to the pods.该应用程序部署到 Kubernetes,它可以扩展和轮询对 pod 的请求。

When load comes in, some pods have available connections and others don't and was wondering, is there a way I can configure a custom load balancer on Kubernetes to forward requests to pods that have the highest available connection count rather than round robin?当负载进来时,一些 pod 有可用的连接,而另一些则没有,我想知道,有没有一种方法可以在 Kubernetes 上配置自定义负载均衡器,将请求转发到具有最高可用连接数的 pod,而不是轮询?

The HTTP protocol has a feature called HTTP keep-alive, or HTTP connection reuse that uses a single TCP connection to send and receive multiple HTTP requests and responses. The HTTP protocol has a feature called HTTP keep-alive, or HTTP connection reuse that uses a single TCP connection to send and receive multiple HTTP requests and responses. follow this doc for Load balancing long-lived connections in Kubernetes按照此文档在 Kubernetes 中对长期连接进行负载平衡

Here are a few examples on how to implement keep-alive in different languages: Keep-alive in Spring boot以下是一些关于如何在不同语言中实现 keep-alive 的示例: Keep-alive in Spring boot

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM