Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-71389

Kubernetes Plugin consumes a lot of threads when managing many Kubernetes Clouds

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • kubernetes-plugin
    • None

      The Kubernetes Plugin spins up a lot of Okhttp threads when many Kubernetes clouds are defined. Even when there is no activity.

      Quickly testing this with the current latest version 3937.vd7b_82db_e347b_, 100 Kubernetes clouds results in 400 Okhttp threads, without build activity.

      Kubernetes plugin keeps a cache of one k8s client per Kubernetes cloud as per https://github.com/jenkinsci/kubernetes-plugin/blob/3937.vd7b_82db_e347b_/src/main/java/org/csanchez/jenkins/plugins/kubernetes/KubernetesClientProvider.java#L54-L55. And per my findings, each client has 2 Okhttp Dispatcher thread (not sure why 2 dispatchers) and 2 other threads (one websocket connection and one http2 connection) at all time.
      Then when we see activity on the controllers, more threads are spun up obviously.

      While managing 100s of k8s clouds sounds like a lot, it is viable requirement: K8s cloud may be restricted / associated to folder so teams can only be given access to specific k8s clouds that are configured globally.

      Therefore I think it qualifies as a scalability / performance problem.
      So this seems like a scalability problem.

            Unassigned Unassigned
            allan_burdajewicz Allan BURDAJEWICZ
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: