Zoltán Borók-Nagy created IMPALA-15649:
------------------------------------------

             Summary: Concurrent codegen cache misses on the same key compile 
the same module several times
                 Key: IMPALA-15649
                 URL: https://issues.apache.org/jira/browse/IMPALA-15649
             Project: IMPALA
          Issue Type: Improvement
          Components: Backend
            Reporter: Zoltán Borók-Nagy


With the codegen cache enabled, LlvmCodeGen::FinalizeModule() looks up the 
cache and on a miss optimizes, compiles and stores the module (llvm-codegen.cc, 
master 9c8bcc9585). When several fragment instances miss on the same key at the 
same time, as on the first run of a query after a restart, each of them 
optimizes and compiles the same module. CodeGenCache::Store() only skips a 
store while another store of the same key is in progress, so a later store 
replaces the equivalent entry stored first and evicts it.

*Proposal:* compile a module once per key:
* The first fragment that misses on a key registers as its compiler.
* The others wait for it, with a timeout, then look up the cache again and 
compile the module themselves only if it is still missing.
* A store is skipped if the cache already holds an entry with the same function 
names hash and at least the same optimization level.
* Profile counters show the number and time of the waits.

*Measured* on TPC-DS SF100 with 5 executors (MT_DOP=0): with a prototype 
(timeout flag default 10 s), the first run after a restart was 3.9% faster in 
total; warm runs were unchanged.

Prototype: https://gerrit.cloudera.org/#/c/25203/




--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to