Gerrit 3.1.3 - Git Protocol v2 not enabled by default

250 views
Skip to first unread message

Doug Luedtke

unread,
May 13, 2020, 5:43:13 PM5/13/20
to Repo and Gerrit Discussion
Today I was asked about the performance difference for Gerrit 3.1.3 with Git protocol v2 enabled and Git 2.26.2. While testing I was not able to get a different in time. Digging into code reviews on googlesource to find test methods I found https://gerrit-review.googlesource.com/c/gerrit/+/208641/12 and it mentions enabling it on each repository.

After following those instructions I was able to reduce the fetch to a fourth compared to protocol 1! 

The Gerrit 3.1 release notes states that Git Protocol V2 is enabled by default. It does not seem to be enabled. https://www.gerritcodereview.com/3.1.html#git-protocol-v2

v2 must be enabled in:
- the repository's .git/config:
  [protocol]
    version = 2
- on the client side, by either passing -c protocol.version=2, or
setting globally in ~/.gitconfig:
  [protocol]
    version = 2

Test commands:
  • time GIT_TRACE_PACKET=1 git -c protocol.version=0 fetch --no-tags origin master
    • real    0m8.606s
    • user    0m0.000s
    • sys     0m0.015s
  • time GIT_TRACE_PACKET=1 git -c protocol.version=2 fetch --no-tags origin master
    • real    0m1.896s
    • user    0m0.000s
    • sys     0m0.015s

Am I misunderstanding what is enabled by default?

Luca Milanesio

unread,
May 13, 2020, 5:49:59 PM5/13/20
to Doug Luedtke, Luca Milanesio, Repo and Gerrit Discussion

On 13 May 2020, at 22:43, Doug Luedtke <douglas...@gmail.com> wrote:

Today I was asked about the performance difference for Gerrit 3.1.3 with Git protocol v2 enabled and Git 2.26.2. While testing I was not able to get a different in time. Digging into code reviews on googlesource to find test methods I found https://gerrit-review.googlesource.com/c/gerrit/+/208641/12 and it mentions enabling it on each repository.

After following those instructions I was able to reduce the fetch to a fourth compared to protocol 1! 

The Gerrit 3.1 release notes states that Git Protocol V2 is enabled by default. It does not seem to be enabled. https://www.gerritcodereview.com/3.1.html#git-protocol-v2

In Gerrit is enabled as an engine, that doesn’t mean that is enabled on the repository or on the client side.


v2 must be enabled in:
- the repository's .git/config:
  [protocol]
    version = 2

Or in the $GERRIT_SITE/etc/jgit.config

- on the client side, by either passing -c protocol.version=2, or
setting globally in ~/.gitconfig:
  [protocol]
    version = 2

Correct, unless you have git client v2.26 where it is enabled by default.

HTH

Luca.



Test commands:
  • time GIT_TRACE_PACKET=1 git -c protocol.version=0 fetch --no-tags origin master
    • real    0m8.606s
    • user    0m0.000s
    • sys     0m0.015s
  • time GIT_TRACE_PACKET=1 git -c protocol.version=2 fetch --no-tags origin master
    • real    0m1.896s
    • user    0m0.000s
    • sys     0m0.015s

Am I misunderstanding what is enabled by default?

--
--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/repo-discuss/23f987b6-7580-425c-a3c6-7ea8e21bab68%40googlegroups.com.

Doug Luedtke

unread,
May 13, 2020, 6:11:03 PM5/13/20
to Repo and Gerrit Discussion
Thank you!

David Ostrovsky

unread,
May 14, 2020, 1:49:01 AM5/14/20
to Repo and Gerrit Discussion

Am Mittwoch, 13. Mai 2020 23:43:13 UTC+2 schrieb Doug Luedtke:
Today I was asked about the performance difference for Gerrit 3.1.3 with Git protocol v2 enabled and Git 2.26.2. While testing I was not able to get a different in time. Digging into code reviews on googlesource to find test methods I found https://gerrit-review.googlesource.com/c/gerrit/+/208641/12 and it mentions enabling it on each repository.

After following those instructions I was able to reduce the fetch to a fourth compared to protocol 1! 

Thanks for confirming! Eclipse Foundation infra team is also in process
of migration to Gerrit 3.1, and they activated git wire protocol v2, see
this comment: [1].


David Ostrovsky

unread,
May 14, 2020, 1:51:23 AM5/14/20
to Repo and Gerrit Discussion

Am Mittwoch, 13. Mai 2020 23:49:59 UTC+2 schrieb lucamilanesio:


On 13 May 2020, at 22:43, Doug Luedtke <douglas...@gmail.com> wrote:

Today I was asked about the performance difference for Gerrit 3.1.3 with Git protocol v2 enabled and Git 2.26.2. While testing I was not able to get a different in time. Digging into code reviews on googlesource to find test methods I found https://gerrit-review.googlesource.com/c/gerrit/+/208641/12 and it mentions enabling it on each repository.

After following those instructions I was able to reduce the fetch to a fourth compared to protocol 1! 

The Gerrit 3.1 release notes states that Git Protocol V2 is enabled by default. It does not seem to be enabled. https://www.gerritcodereview.com/3.1.html#git-protocol-v2

In Gerrit is enabled as an engine, that doesn’t mean that is enabled on the repository or on the client side.


v2 must be enabled in:
- the repository's .git/config:
  [protocol]
    version = 2

Or in the $GERRIT_SITE/etc/jgit.config

- on the client side, by either passing -c protocol.version=2, or
setting globally in ~/.gitconfig:
  [protocol]
    version = 2

Correct, unless you have git client v2.26 where it is enabled by default.

Why don't we flip the bit in JGit per default, so that someone who would like
to downgrade used wire protocol would have to say:

  protocol.version = 1

That why with greatest and latest Gerrit and git core, git wire protocol v2
would just work out of the box.

David Ostrovsky

unread,
May 14, 2020, 2:16:23 AM5/14/20
to Repo and Gerrit Discussion
I wrote this FR upstream: [1].


Luca Milanesio

unread,
May 14, 2020, 7:45:06 AM5/14/20
to David Ostrovsky, Matthias Sohn, Luca Milanesio, Repo and Gerrit Discussion
That would be nice, also that would align the JGit defaults with Git v2.26.

@Matthias?

Luca.



--
--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.

Doug Luedtke

unread,
May 18, 2020, 2:38:15 PM5/18/20
to Repo and Gerrit Discussion
On Thursday, May 14, 2020 at 1:16:23 AM UTC-5, David Ostrovsky wrote:

I wrote this FR upstream: [1].



Awesome idea! Thank you.

I must have missed in the Gerrit release notes or the documentation where the jgit.config needs to have the protocol enabled. At least in my testing the change was able to be added live by updating the jgit.config with "git config -f ./jgit.config protocol.version 2".

Luca Milanesio

unread,
May 18, 2020, 5:31:14 PM5/18/20
to Doug Luedtke, Luca Milanesio, Repo and Gerrit Discussion
Ponch (aka Fabio Ponciroli) has published today a blog post on the topic:

HTH

Luca.

Doug Luedtke

unread,
May 19, 2020, 11:01:40 AM5/19/20
to Repo and Gerrit Discussion
On Monday, May 18, 2020 at 4:31:14 PM UTC-5, lucamilanesio wrote:

Ponch (aka Fabio Ponciroli) has published today a blog post on the topic:

HTH

Luca.

Thank you! 

David Ostrovsky

unread,
May 19, 2020, 11:31:45 AM5/19/20
to Repo and Gerrit Discussion
This CL enabled Git wire protocol v2 in JGit per default: [1].
The tests are still broken, but who cares about the tests ;-)


Reply all
Reply to author
Forward
0 new messages