Skip to content

PackObjectsHookWithSidechannel: buffer stdout data

Jacob Vosmaer requested to merge jv-buffer-pack-objectshook into master

PackObjectsHookWithSidechannel can sometimes show stuttering behavior, where small writes from 'git pack-objects' becomes small writes into the cache, small reads from the cache, small network sends, small network receives, and small pipe writes. If we make the initial writes bigger then each successive read and write down the chain gets bigger too.

This change adds buffering for the stdout stream of PackObjectsHookWithSidechannel. This also applies to PackObjectsHook.

In the small experiment below this saves 15% CPU across gitaly and gitaly-hooks. Real life savings will depend on the data in the repository, how it's compressed, and which data the user is fetching.

No buffering:

192.168.64.7-2021-08-30_1533.gz.svg

With buffering:

192.168.64.7-2021-08-30_1532.gz.svg

Edited by Jacob Vosmaer

Merge request reports

Loading