Skip to content

Shallow clone for better performance #1544

Open

Description

@marnee01

We regularly see response times from our config server of 15-25 seconds. We have on average ~30 requests with response times > 15s each day. These high response times happen when config server is fetching from one of our repos and there are updates in that repo. There are often updates since any time someone creates a new feature branch and makes a change to it, that is an update.

This repo has many, many files in it (for multiple applications). Some of the files have 1000s of lines. But the biggest culprit, I believe, is that it has a huge amount of history.

We are looking at potentially breaking it into multiple repos (and use the new composite repos feature for shared configs). That will help. However, the team wants to migrate the history over to the new repos, so now we will have multiple repos with huge history instead of just one.

We were hoping that we could improve performance by configuring the config server to do a shallow clone of the repos (e.g. git clone --depth 1) . There doesn't appear to be an option for that right now.

The Request: I'd like to request you to enhance the config server to allow for optionally doing a shallow clone.

I realize this might not be feasible. I'm nearly a novice with git, and not sure if such a shallow clone would "play nicely" with the existing config server repo wrt to updates, etc. Also, it appears that the jgit library itself does not expose an option for doing a shallow sync (though I could have missed something).

If not feasible, or not something that might be implemented in the next couple of releases, is there an existing alternative option that might help improve our config server's response time? (Even if this feature does get into the queue, is there something I can do right now to improve performance?)

Note: We're currently at Greenwich.SR3.

Activity

  1. dungtm007 commented on Dec 18, 2020

    @dungtm007

    Is there any update on this enhancement?

  2. Michael-S-Smith commented on Mar 10, 2022

    @Michael-S-Smith

    Any update on this? We would also be helped by having a shallow clone option. Is there really any reason to ever want branch history in the cloned branch used by cloud config?

  3. vladonemo commented on Jul 26, 2022

    @vladonemo
    Contributor

    Would like to have this feature, too. Sadly, jgit doesn't support shallow clone yet. See the bug and gerrit.

    It does support the partial clone though. You can achieve this by adding your own TransportConfigCallback to the repository, e.g.:

            TransportConfigCallback callback = t -> {
                t.setFilterSpec(FilterSpec.fromFilterLine("tree:0"));
                t.setFilterSpec(FilterSpec.fromFilterLine("blob:none"));
            }

    However, not all git servers comply with the partial clone spec, e.g. Azure DevOps doesn't

  4. michael-schnell commented on Jan 25, 2024

    @michael-schnell

    I guess JGit supports in the meantime what is requested here:

    Shallow Clone and Fetch
    The following methods were added to CloneCommand and FetchCommand to tell the server that the client doesn't want to download the complete history

    https://wiki.eclipse.org/JGit/New_and_Noteworthy/6.3

  5. added 4 commits that reference this issue on Apr 9, 2024
    8a0ae52
    2e13af5
    68f2926
    d0c8281
  6. adelriodev commented on Feb 3, 2025

    @adelriodev

    Hi there! Are there any updates on this on this enhancement?

  7. added a commit that references this issue on Jun 6, 2025
    a5786c0
  8. added a commit that references this issue on May 31, 2026
    4b63dcf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions