Uploaded image for project: 'Apache YuniKorn'
  1. Apache YuniKorn
  2. YUNIKORN-1715 Yunikorn performance improvements
  3. YUNIKORN-1723

Remove string comparison from hasReadyCondition() function

    XMLWordPrintableJSON

Details

    Description

      Kubemark testing identified an expensive method in the shim, which is called for every node update.

      func hasReadyCondition(node *v1.Node) bool {
         if node != nil && node.Status.String() != "nil" {
            for _, condition := range node.Status.Conditions {
               if condition.Type == v1.NodeReady && condition.Status == v1.ConditionTrue {
                  return true
               }
            }
         }
         return false
      } 

       

      node.Status cannot be nil, and Status.String() builds a decently sized string. The check against "nil" should be deleted.

       

       

      Attachments

        1. hasReadyCondition.png
          106 kB
          Peter Bacsko

        Issue Links

          Activity

            People

              pbacsko Peter Bacsko
              pbacsko Peter Bacsko
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: