Setting a Proper Number of Cores and Operator Kernel Type

During operator execution, additional startup overhead or header overhead may be generated due to the following reasons:

  1. Core startup: Each core needs to be initialized when it is started, and necessary configurations and resources need to be loaded.
  2. Core addressing TLB miss: When a core accesses the memory, if the Translation Lookaside Buffer (TLB) does not contain the corresponding page table entry, the page table entry needs to be loaded from the memory, which causes additional latency.
  3. Same-address access conflict: Due to hardware limitations, conflicts may occur when multiple cores access the same memory address at the same time, resulting in additional latency.
  4. Variable resource initialization: Before operator execution, some variables and resources need to be initialized, which may also cause additional performance overhead.

The header overhead increases with the number of used cores. The following figure shows the change of the header overhead with the number of started cores.

Figure 1 Header overhead changes with the number of started cores

For operators whose overall execution duration is at the microsecond level and whose single-core compute time is relatively short, you can reduce the number of started cores and increase the single-core compute amount to improve performance. This optimization method is essentially a trade-off between the time consumed by the header overhead and the time consumed by the single-core compute. To achieve optimal performance, you need to find an appropriate number of cores through practical attempts.