Uploaded image for project: 'IMPALA'
  1. IMPALA
  2. IMPALA-3106

Runtime filter GetNextRange lock contention with RUNTIME_FILTER_WAIT_TIME_MS > 0

    XMLWordPrintableJSON

Details

    Description

      When RUNTIME_FILTER_WAIT_TIME_MS is set there is kernel spinning, which appears to be a busy wait, RuntimeFilter::WaitForArrival is wakes up every 20ms and checks so it shouldn't be causing any spinning.

      Repro

      use tpch_parquet;
      set RUNTIME_FILTER_MODE=2;
      set RUNTIME_FILTER_WAIT_TIME_MS=100000;
      SELECT SUM(L_EXTENDEDPRICE)/7.0 AS AVG_YEARLY FROM LINEITEM, PART
      WHERE P_PARTKEY = L_PARTKEY AND P_BRAND = 'Brand#23' AND P_CONTAINER = 'MED BOX'
      AND L_QUANTITY < (SELECT 0.2*AVG(L_QUANTITY) FROM LINEITEM WHERE L_PARTKEY = P_PARTKEY);
      

      The amount of spinning increases with NUM_SCANNER_THREADS and this is the call stack from Vtune, couldn't figure out why this contention is happening

      CPU Time
      1 of 2: 89.5% (9.238s of 10.320s)
      
      impalad ! pthread_mutex_lock - mutex.hpp
      impalad ! boost::mutex::lock + 0x15 - mutex.hpp:116
      impalad ! boost::unique_lock<boost::mutex>::lock + 0x7f - lock_types.hpp:346
      impalad ! boost::unique_lock<boost::mutex>::unique_lock + 0x2e - lock_types.hpp:124
      impalad ! impala::DiskIoMgr::GetNextRange + 0x1a3 - disk-io-mgr.cc:556
      impalad ! impala::HdfsScanNode::ScannerThread + 0x3f5 - hdfs-scan-node.cc:1039
      impalad ! boost::_mfi::mf0<void, impala::HdfsScanNode>::operator() + 0x64 - mem_fn_template.hpp:49
      impalad ! boost::_bi::list1<boost::_bi::value<impala::HdfsScanNode*>>::operator()<boost::_mfi::mf0<void, impala::HdfsScanNode>, boost::_bi::list0> + 0x49 - bind.hpp:253
      impalad ! boost::_bi::bind_t<void, boost::_mfi::mf0<void, impala::HdfsScanNode>, boost::_bi::list1<boost::_bi::value<impala::HdfsScanNode*>>>::operator() + 0x3a - bind_template.hpp:20
      impalad ! boost::detail::function::void_function_obj_invoker0<boost::_bi::bind_t<void, boost::_mfi::mf0<void, impala::HdfsScanNode>, boost::_bi::list1<boost::_bi::value<impala::HdfsScanNode*>>>, void>::invoke + 0x1f - function_template.hpp:153
      impalad ! boost::function0<void>::operator() + 0x51 - function_template.hpp:767
      impalad ! impala::Thread::SuperviseThread + 0x2c4 - thread.cc:316
      impalad ! boost::_bi::list4<boost::_bi::value<std::string>, boost::_bi::value<std::string>, boost::_bi::value<boost::function<void (void)>>, boost::_bi::value<impala::Promise<long>*>>::operator()<void (*)(std::string const&, std::string const&, boost::function<void (void)>, impala::Promise<long>*), boost::_bi::list0> + 0xb1 - bind.hpp:457
      impalad ! boost::_bi::bind_t<void, void (*)(std::string const&, std::string const&, boost::function<void (void)>, impala::Promise<long>*), boost::_bi::list4<boost::_bi::value<std::string>, boost::_bi::value<std::string>, boost::_bi::value<boost::function<void (void)>>, boost::_bi::value<impala::Promise<long>*>>>::operator() + 0x3a - bind_template.hpp:20
      impalad ! boost::detail::thread_data<boost::_bi::bind_t<void, void (*)(std::string const&, std::string const&, boost::function<void (void)>, impala::Promise<long>*), boost::_bi::list4<boost::_bi::value<std::string>, boost::_bi::value<std::string>, boost::_bi::value<boost::function<void (void)>>, boost::_bi::value<impala::Promise<long>*>>>>::run + 0x1d - thread.hpp:116
      impalad ! thread_proxy + 0xd9 - [unknown source file]
      libpthread.so.0 ! start_thread + 0xc1 - pthread_create.c:312
      libc.so.6 ! __clone + 0x6c - clone.S:111
      

      Attachments

        1. ExplainPlanGoingThroughCodeGen.csv
          10 kB
          Mostafa Mokhtar

        Activity

          People

            henryr Henry Robinson
            mmokhtar Mostafa Mokhtar
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: