Uploaded image for project: 'Apache Drill'
  1. Apache Drill
  2. DRILL-1990

Add peak memory allocation in a operator to OperatorStats.

    XMLWordPrintableJSON

Details

    Description

      Currently we have "localMemoryAllocated" which is always set to zero as we try to fill the stats at the end of fragment execution by calling allocator.getAllocatedMemory() which at that point has already released the allocated memory. Instead if we have a stat for peak memory an allocator has seen in the lifetime of the operator execution will be useful (each operator has its own allocator).

      Example query on query profile: To find aggregate of peak memory of each operator across all minor fragments in a major fragment and list them in descending order of peak memory usage

      SELECT
        majorFragmentId,
        opProfile['operatorType'] opType,
        sum(opProfile['peakLocalMemoryAllocated']) aggPeakMemoryAcrossAllMinorFragments 
      FROM 
        (SELECT
             majorFragmentId,
             flatten(minorFragProfile['operatorProfile']) opProfile
         FROM 
             (SELECT
                   majorFragment['majorFragmentId'] majorFragmentId, 
                   flatten(majorFragment['minorFragmentProfile']) minorFragProfile
               FROM
                   (SELECT flatten(fragmentProfile) as majorFragment from dfs.`/tmp/a.json`)
               )
         )
      -- WHERE opProfile['operatorType'] = 6 -- If want to filter to particular operator
      GROUP BY 
        majorFragmentId,
        opProfile['operatorType']
      ORDER BY
        aggPeakMemoryAcrossAllMinorFragments DESC;
      
      +-----------------+------------+--------------------------------------+
      | majorFragmentId |   opType   | aggPeakMemoryAcrossAllMinorFragments |
      +-----------------+------------+--------------------------------------+
      | 1               | 4          | 115065856                            |
      | 1               | 3          | 10027008                             |
      | 0               | 3          | 1671168                              |
      | 3               | 6          | 1536000                              |
      | 2               | 6          | 901120                               |
      | 1               | 6          | 606208                               |
      | 3               | 28         | 393216                               |
      | 2               | 28         | 229376                               |
      | 3               | 10         | 122880                               |
      | 2               | 10         | 81920                                |
      | 0               | 11         | 0                                    |
      | 0               | 10         | 0                                    |
      | 0               | 13         | 0                                    |
      | 1               | 10         | 0                                    |
      | 1               | 11         | 0                                    |
      +-----------------+------------+--------------------------------------+
      

      Attachments

        1. DRILL-1990-1.patch
          25 kB
          Venki Korukanti

        Activity

          People

            vkorukanti Venki Korukanti
            vkorukanti Venki Korukanti
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: