A burst of git calls no longer holds up Obeya's server

Obeya runs git all the time, often many calls at once: one in each clone, plus landings and fetches. Starting a process blocks the thread that asks for it until the system has created the process. Until now that thread was the server's own. On Windows, creating a process takes tens of milliseconds on an idle machine and seconds under load (antivirus, many git calls together). A burst of starts therefore froze the server for 10–20 seconds. Pages and phones showed "Obeya is not answering", and connections timed out while opening.

Now two helper threads start these processes. The server's thread only hands over the command and gets the output back, so it keeps answering while the processes start.

On a busy Windows machine

Measured by the contributor: 120 git status calls in three waves of 40, while four other processes kept the machine busy with git.

RunLongest freeze, beforeafterTime frozen in total, beforeafter
First run0.58 s0.31 s3.2 s1.5 s
Second run1.6 s0.17 s16.2 s0.17 s

On a Mac

300 git status calls at once through Obeya's own code for starting processes, before and after the change, ten rounds each. Shown is the longest stretch in each round during which the server could do nothing else. A Mac creates processes quickly, so the stretches are milliseconds rather than seconds, but the typical stretch falls from about 40 ms to about 7 ms.

BeforeAfter
Show as a table
RoundBefore (ms)After (ms)

Every git call finished in both versions, in under half a second for all 300.