git/list[1] front-page[2] threads[3] people[4] search[5] about
 

protocol v2: More data transmitted between client and server since v2.20.0

From
Kaartic Sivaraam <kaartic.sivaraam@gmail.com>
Date
Jan 21, 2019, 06:15 UTC
Message-ID
<CA+ARAtpAN_DJ-zgiwPEBqV1EotgsmggRRQWB59u8O_OPR_kFrw@mail.gmail.com>
Hi all,

I recently came across a blog[1] about how protocol v2 speeds up the transfer between the client and the server. It states that the amount of data transmitted between the client and the server is less when using the protocol v2.

To demonstrate the difference between v0 and v2 two commands were mentioned in the blog. The results hold true for me when I test using Git v2.18.1. The commands given there worked as mentioned in the blog until Git v2.18.1. But when I run the same commands using Git v2.20.0 or the one I built from source in the 'next' branch (at aa96b0ce6b). I'm not sure why this is the case. Some observations below:

Protocol v0 =========== # Git version: 2.18.1 $ GIT_TRACE_PACKET=1 git -c protocol.version=0 ls-remote git@gitlab.com:gitlab-org/gitlab-ce.git master 2>git_protocol_0_git_2.18.1_stderr.txt d4d4ebadfb373518013382560b1f505eb6217f13 refs/heads/master

$ wc -l git_protocol_0_git_2.18.1_stderr.txt 36848 git_protocol_0_git_2.18.1_stderr.txt

# Git version: 2.19.0 $ GIT_TRACE_PACKET=1 git -c protocol.version=0 ls-remote git@gitlab.com:gitlab-org/gitlab-ce.git master 2>git_protocol_0_git_2.19.0_stderr.txt d4d4ebadfb373518013382560b1f505eb6217f13 refs/heads/master

$ wc -l git_protocol_0_git_2.19.0_stderr.txt 36848 git_protocol_0_git_2.19.0_stderr.txt

# Git version: 2.20.0 $ GIT_TRACE_PACKET=1 git -c protocol.version=0 ls-remote git@gitlab.com:gitlab-org/gitlab-ce.git master 2>git_protocol_0_git_2.20.0_stderr.txt d4d4ebadfb373518013382560b1f505eb6217f13 refs/heads/master

$ wc -l git_protocol_0_git_2.20.0_stderr.txt 36848 git_protocol_0_git_2.20.0_stderr.txt

# Git version: 2.20.1.495.gaa96b0ce6b $ GIT_TRACE_PACKET=1 git -c protocol.version=0 ls-remote git@gitlab.com:gitlab-org/gitlab-ce.git master 2>git_protocol_0_git_2.20.1-source_stderr.txt d4d4ebadfb373518013382560b1f505eb6217f13 refs/heads/master

$ wc -l git_protocol_0_git_2.20.1-source_stderr.txt 36848 git_protocol_0_git_2.20.1-source_stderr.txt

Protocol v2 =========== # Git version: 2.18.1 $ GIT_TRACE_PACKET=1 git -c protocol.version=2 ls-remote git@gitlab.com:gitlab-org/gitlab-ce.git master 2>git_protocol_2_git_2.18.1_stderr.txt d4d4ebadfb373518013382560b1f505eb6217f13 refs/heads/master

$ wc -l git_protocol_2_git_2.18.1_stderr.txt 22 git_protocol_2_git_2.18.1_stderr.txt

# Git version: 2.19.0 $ GIT_TRACE_PACKET=1 git -c protocol.version=2 ls-remote git@gitlab.com:gitlab-org/gitlab-ce.git master 2>git_protocol_2_git_2.19.0_stderr.txt d4d4ebadfb373518013382560b1f505eb6217f13 refs/heads/master

$ wc -l 22 git_protocol_2_git_2.19.0_stderr.txt

# Git version: 2.20.0 $ GIT_TRACE_PACKET=1 git -c protocol.version=2 ls-remote git@gitlab.com:gitlab-org/gitlab-ce.git master 2>git_protocol_2_git_2.20.0_stderr.txt d4d4ebadfb373518013382560b1f505eb6217f13 refs/heads/master 04845fdeae75ba5de7c93992a5d55663edf647e0 refs/remotes/remote_mirror_630f74462b3b08a952486da866d5e702/master 04845fdeae75ba5de7c93992a5d55663edf647e0 refs/remotes/remote_mirror_655ad545056a2ad17e7ebc5461a986e4/master d4d4ebadfb373518013382560b1f505eb6217f13 refs/remotes/remote_mirror_d612bbe5bee4fbc624df371bc7caa759/master

$ wc -l git_protocol_2_git_2.20.0_stderr.txt 160971 git_protocol_2_git_2.20.0_stderr.txt

# Git version: 2.20.1.495.gaa96b0ce6b $ GIT_TRACE_PACKET=1 git -c protocol.version=2 ls-remote git@gitlab.com:gitlab-org/gitlab-ce.git master 2>git_protocol_2_git_2.20.1-source_stderr.txt d4d4ebadfb373518013382560b1f505eb6217f13 refs/heads/master 04845fdeae75ba5de7c93992a5d55663edf647e0 refs/remotes/remote_mirror_630f74462b3b08a952486da866d5e702/master 04845fdeae75ba5de7c93992a5d55663edf647e0 refs/remotes/remote_mirror_655ad545056a2ad17e7ebc5461a986e4/master d4d4ebadfb373518013382560b1f505eb6217f13 refs/remotes/remote_mirror_d612bbe5bee4fbc624df371bc7caa759/master

$ wc -l git_protocol_2_git_2.20.1-source_stderr.txt 160971 git_protocol_2_git_2.20.1-source_stderr.txt

Also, note that there are more refs printed when using v2 which is spooky too. I thought of running a bisect to find the actual culprit but wanted to know if this was *actually* an issue or not? Any thoughts?

References ========== [1]: https://about.gitlab.com/2018/12/10/git-protocol-v2-enabled-for-ssh-on-gitlab-dot-com/

-- Sivaraam

P.S.: I previously sent this email but it doesn't seemed to have reached the mailing list (as verified by checking the archives) for some unknown reason. So, I've re-sent this email. Sorry if this was redundant.

Next: Jeff King
Message 1 of 3 in “protocol v2: More data transmitted between client and server since v2.20.0”
  1. Kaartic SivaraamJan 21, 2019
  2. Jeff KingJan 28, 2019
  3. Kaartic.SivaraamFeb 2, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.