-
Notifications
You must be signed in to change notification settings - Fork 4.9k
[Improvement-88][SERVER] Kubernetes Connection Pool Implementation #17510
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
base: dev
Are you sure you want to change the base?
Conversation
… and adapted to special handling in Watch scenarios
…connection pool interface of K8sUtils through the configYaml parameter
Thanks for opening this pull request! Please check out our contributing guidelines. (https://github.com/apache/dolphinscheduler/blob/dev/docs/docs/en/contribute/join/pull-request.md) |
...c/main/java/org/apache/dolphinscheduler/plugin/task/api/am/KubernetesApplicationManager.java
Fixed
Show fixed
Hide fixed
...-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/k8s/KubernetesClientPool.java
Fixed
Show fixed
Hide fixed
...-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/k8s/KubernetesClientPool.java
Fixed
Show fixed
Hide fixed
...-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/k8s/KubernetesClientPool.java
Fixed
Show fixed
Hide fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This pr's title and DSIP-88 are no related. Please modify the correct title and with full design detail and description. @Cat-Drink
|
Purpose of the pull request
This pull request introduces support for the Kubernetes client connection pool, optimizing the interaction performance and resource management between Apache DolphinScheduler and Kubernetes clusters. By maintaining a reuse mechanism for client connections, this feature significantly reduces the overhead caused by frequent creation and destruction of Kubernetes clients, thereby improving the overall efficiency and stability of the system.
Brief change log
KubernetesClientPool
class, which implements a singleton-pattern connection pool manager to maintain an independent connection pool for each Kubernetes cluster.PoolConfig
inner class, which supports configuration items such as minimum idle connections, maximum idle connections, maximum connections, maximum waiting time, and idle timeout. These configurations can be customized through properties inTaskConstants
.ClusterClientPool
inner class, which is responsible for managing client connections of specific clusters, including the creation, acquisition, return, and closure of connections.cleanupIdleClients
method every 30 seconds to clear timed-out idle connections, effectively saving resources.isClientValid
method to ensure that the returned client connection remains valid.K8sUtils
andKubernetesApplicationManager
to enable them to acquire and return clients using the connection pool.Verify this pull request
This change includes comprehensive test cases and can be verified through the following methods:
Automated Testing
KubernetesClientPoolTest.testKubernetesClientPoolBasicFunction
verifies the basic operations of the connection pool (acquiring cluster ID, obtaining client, returning client, and closing the connection pool).KubernetesClientPoolTest.testKubernetesClientPoolConfig
verifies the correctness of connection pool configurations.KubernetesClientPoolTest.testClusterIdGeneration
verifies the function of generating a unique cluster identifier based on kubeconfig.KubernetesClientPoolTest.testSingletonPattern
verifies the singleton pattern implementation of the connection pool.KubernetesClientPoolTest.testClusterClientPoolBorrowObjectTimeout
verifies the handling mechanism for client acquisition timeouts.KubernetesClientPoolTest.testCleanupIdleClients
andKubernetesClientPoolTest.testClusterClientPoolCleanupIdle
verify the periodic cleanup function of idle connections.Manual Verification Steps
k8s.client.pool.max.size
) are set in the configuration file.Pull Request Notice
Pull Request Notice
If your pull request contains incompatible change, you should also add it to
docs/docs/en/guide/upgrade/incompatible.md