Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-24819

Higher APIServer cpu load after using SharedIndexInformer replaced naked Kubernetes watch

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    Description

      In FLINK-22054, Flink has used a shared informer for ConfigMap to replace the naked K8s watch. After then, each Flink JVM process(JM/TM) only needs one connection to APIServer for ConfigMap watching. It aims to reduce the network pressure on K8s APIServer.

       

      However, in our recent tests, we found that the CPU and memory cost of APIServer have been doubled while running same Flink workloads. After digging more details in the K8s, I think the root cause might be that ETCD does not have indexes for labels. It means APIServer need to pull all the events from ETCD for each watch and then filter with specified labels(e.g. app=xxx,type=flink-native-kubernetes,configmap-type=high-availability) internally. Before FLINK-22054, we started a dedicated connection for each ConfigMap watching. And it seems that APIServer only need to pull the events for the specified ConfigMap name.

       

      Watch URL example(Before):

      https://kubernetes.default:6443/api/v1/namespaces/vvp-workload/configmaps?metadata.name=job-009d4f51-ca02-4793-a49b-a3344538719b-resourcemanager-leader&watch=true

       

      Watch URL example(After):

      https://kubernetes.default:6443/api/v1/namespaces/vvp-workload/configmaps?labelSelector=app%3Dk8s-ha-app-1-1636077491-23461%2Ctype%3Dflink-native-kubernetes%2Cconfigmap-type%3Dhigh-availability&resourceVersion=1153687321&watch=true

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            wangyang0918 Yang Wang
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment