Why does parLapplyLB not actually balance load? : <p>I'm testing out the <code>parLapplyLB()</code> function to understand what it does to balance a load. But I'm not seeing any balancing happening. For example,</p>

<pre><code>cl &lt;- parallel::makeCluster(2)

system.time(
  parallel::parLapplyLB(cl, 1:4, function(y) {
    if (y == 1) {
      Sys.sleep(3)
    } else {
      Sys.sleep(0.5)
    }}))
##   user  system elapsed 
##  0.004   0.009   3.511 

parallel::stopCluster(cl)
</code></pre>

<p>If it was truly balancing the load, the first job (job 1) that sleeps for 3 seconds would be on the first node and the other three jobs (jobs 2:4) would sleep for a total of 1.5 seconds on the other node. In total, the system time should only be 3 seconds.</p>

<p>Instead, I think that jobs 1 and 2 are given to node 1 and jobs 3 and 4 are given to node 2. This results in the total time being 3 + 0.5 = 3.5 seconds. If we run the same code above with <code>parLapply()</code> instead of <code>parLapplyLB()</code>, we get the same system time of about 3.5 seconds.</p>

<p>What am I not understanding or doing wrong?</p>
