Uploaded image for project: 'Phoenix'
  1. Phoenix
  2. PHOENIX-6944

Randomize mapper task ordering for Index MR tools

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 5.2.0, 5.1.4
    • core
    • Hide
      Phoenix can now randomize the mapper execution order for MapReduce tools.
      This is enabled by default for IndexTool and IndexScrutinyTool.
      The randomization can be enabled or disabled for all MR tools via the "phoenix.mapreduce.randomize.mapper.execution.order" boolean property.
      Show
      Phoenix can now randomize the mapper execution order for MapReduce tools. This is enabled by default for IndexTool and IndexScrutinyTool. The randomization can be enabled or disabled for all MR tools via the "phoenix.mapreduce.randomize.mapper.execution.order" boolean property.

    Description

      Currently, splits are generated by PhoenixInputFormat are in ascending order.
      MR does not use this ordering directly, it instead orders the partitions by size in descending order.
      We set the sizes of the splits to the region size. (Even when splitting by guideposts, but this not really a problem)
      The result is that mapper jobs are grouped by regions, so usually all the mappers running are working on one, or few regions. As a result we have the following problems:

      Read hotspotting:
      All scan operations for the indexing job hit the same one or few region servers, causing high loads and slowdowns.

      Write hotspotting:
      If the data rowkeys and index rowkeys strongly correlate, then the data read from one or few data regions will be written to one or few index regions, causing high loads and slowdowns. This is a bit of a corner case, we have obeserved it when building an index for a column which starts with the same bytes as the primary key for the data table.

      We can improve this by making sure that the generate mapper jobs are executed in a random order. The only way to change the execution order is to manipulate the length of the splits. As the length is only used for ordering, and calculating completion percentage, this is unlikely to cause problems (we already specify wildly off lengths when splitting by guidepost )

      I've run some test on a 50M row, 40GB data table, generating secondary indexes for a correlated field and for a random field:
      The test system has three RS workers, and 12 yarn slots for running IndexTool

      Index rebuild time on correlated field on random field
      w/o randomization 50 min 28 min
      w/ randomization 30 min 23 min

      Attachments

        Issue Links

          Activity

            People

              stoty Istvan Toth
              stoty Istvan Toth
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: