Example #1
0
 def evaluate(self, profile, plan_node_id):
     """
     Determine the impact of NN RPC latency
     this format:
     {
         "impact": the amount of slow down (in ns),
         "message" : the displayed "explanation" string
     }
     :return:
     """
     totalStorageTime = models.query_avg_fragment_metric_by_node_nid(
         profile, plan_node_id, "TotalStorageWaitTime", 0)
     hdfsRawReadTime = models.query_node_by_id_value(
         profile, plan_node_id, "TotalRawHdfsReadTime(*)", True)
     avgReadThreads = models.query_node_by_id_value(
         profile, plan_node_id, "AverageHdfsReadThreadConcurrency", True)
     avgReadThreads = max(1, to_double(avgReadThreads))
     impact = max(
         0, math.floor(
             (totalStorageTime - hdfsRawReadTime) / avgReadThreads))
     return {
         "impact": impact,
         "message": "This is the time waiting for HDFS NN RPC.",
         "label": "HDFS NN RPC"
     }
Example #2
0
    def evaluate(self, profile, plan_node_id):
        """
        Determine if the join exploded the number of rows
        this format:
        {
            "impact": the amount of slow down (in ns),
            "message" : the displayed "explanation" string
        }
        :return:
        """
        self.metric_names = ["Hosts", "Broadcast", "BuildRows", "ProbeRows"]

        hosts = models.query_node_by_id_value(profile, plan_node_id, "Hosts",
                                              True)
        probeRows = models.query_node_by_id_value(profile, plan_node_id,
                                                  "ProbeRows", True)
        probeTime = models.query_node_by_id_value(profile, plan_node_id,
                                                  "ProbeTime", True)
        rowsReturned = models.query_node_by_id_value(profile, plan_node_id,
                                                     "RowsReturned", True)

        impact = 0
        if (rowsReturned > 0):
            impact = probeTime * (rowsReturned - probeRows) / rowsReturned
        return {
            "impact":
            impact,
            "message":
            "%d input rows are exploded to %d output rows" %
            (probeRows, rowsReturned),
            "label":
            "Exploding join"
        }
Example #3
0
    def evaluate(self, profile, plan_node_id):
        """
        Determine if the join order/strategy is correct and evaluate the impact of this cause
        to the query. The return is a json string with
        this format:
        {
            "impact": the amount of slow down (in ns),
            "message" : the displayed "explanation" string
        }
        :return:
        """
        self.metric_names = ["Hosts", "Broadcast", "BuildRows", "ProbeRows"]

        hosts = models.query_node_by_id_value(profile, plan_node_id, "Hosts",
                                              True)
        isBroadcast = models.query_node_by_id_value(profile, plan_node_id,
                                                    "Broadcast", True)
        buildRows = models.query_node_by_id_value(profile, plan_node_id,
                                                  "BuildRows", True)
        probeRows = models.query_node_by_id_value(profile, plan_node_id,
                                                  "ProbeRows", True)

        rhsRows = 0
        lhsRows = 0
        networkcost = 0
        if (isBroadcast == 1):
            networkcost = buildRows * hosts
            rhsRows = buildRows
            lhsRows = probeRows * hosts
        else:
            networkcost = (buildRows + probeRows) * hosts
            rhsRows = buildRows * hosts
            lhsRows = probeRows * hosts

        impact = math.floor((rhsRows - lhsRows * 1.5) / hosts / 0.01)
        if (impact > 0):
            return {
                "impact": impact,
                "message": "RHS %d; LHS %d" % (rhsRows, lhsRows),
                "label": "Wrong join order"
            }

        bcost = rhsRows * hosts
        scost = lhsRows + rhsRows
        impact = math.floor(
            (networkcost - min(bcost, scost) - 1) / hosts / 0.01)
        return {
            "impact": impact,
            "message": "RHS %d; LHS %d" % (rhsRows, lhsRows),
            "label": "Wrong join strategy"
        }