While going through https://www.speedshop.co/2020/05/11/the-ruby-gvl-and-scaling.html, I read
Amdahl's Law is simply 1 / (1 - p + p/s), where p is the percentage of the task that could be done in parallel, and s is the speedup factor from the part of the task that gained improved resources (the parallel part).
So, in our example, let's say that half of SatelliteDataProcessorJob is GVL-bound and half is IO-bound. In this case, p is 0.5 and s is 10, because we can wait for IO in parallel and there are 10 threads. In this case, Amdahl's Law shows that a Sidekiq process would go through our jobs up to 1.81x faster than a single-threaded Resque or DelayedJob process.
Question: In this case, shouldn’t speed up be 2x as IO-bound portion takes practically zero CPU time rather than p/s i.e., s = ♾️. Wondering what I am missing here? 🤔
Why do I think speedup will be 2x?
Since an IO bound task would not take any CPU time, I am assuming that speedup s
would be unlimited after 1/(1-p)
number of threads
e.g., for 2 threads & 50% IO
for first half of second
we run first job’s CPU bound portion and second job’s IO bound portion
in second half of second
we run first job’s IO bound portion and second job’s CPU bound portion
If I have to formulate, I would say speedup when using n
threads on jobs which have p
% IO would be [n, 1/(1-p)].min