改善通过NFS的Git性能。

huangapple go评论57阅读模式
英文:

Improve git over NFS performance

问题

我的公司有一个分布式系统,在其中,一台远程的CentOS机器分配工作人员的主目录,所有我们的git仓库都在这台机器上运行、构建和执行。

在我的本地机器(Ubuntu)上,我通过NFS挂载了远程主目录,以便能够使用我喜欢的IDE编辑文件。

为了管理版本控制,我想在我的本地机器上使用GitKraken(没有SSH隧道),但速度非常慢。如果我在命令行中使用git通过SSH连接到远程机器,性能通常是正常的。如果我在本地执行相同的操作,速度会慢一些,但仍然可以使用。我猜想GitKraken在后台执行了更多的操作,导致累积的延迟。

有没有办法提高性能或者有更好的方法来满足这些要求?我希望能够在本地使用GitKraken和vsc。

我已经尝试了几种方法,比如:使用systemd挂载、sshfs、用git gc清理仓库、在我的本地机器上刷新git索引(因为我读到过它可能影响在CentOS和Debian上的创建),改进NFS选项和缓存等等。

附注:我有一个改善Git性能的疯狂想法。我在我的本地机器上创建了一个Git别名,首先通过SSH连接到远程机器:

alias git='ssh -A <user>@<host> "cd ${PWD} && git"'

与在NFS挂载的仓库上使用Git相比,这显著提高了性能。

虽然我知道可能有办法通过Git配置代理进一步提高性能,虽然这种方法有它的不便之处,但在我的情况下还是可以接受的。然而,我的主要兴趣在于使用GitKraken。

由于GitKraken使用自己的Git实现(libgit2),它不依赖于裸机器上安装的Git。在这方面,我的手是被捆绑住的。

英文:

My company has a distributed system in which a remote CentOS machine allocates worker's home directories with all our git repos working, built and executed on it.

In my local machine (Ubuntu), I've the remote home directory mounted over NFS to be able to edit the files with my favourite IDE.

For managing the version control I want to use GitKraken on my local machine (there is no SSH tunneling) but is extremely slow.
If I use git from command lines connecting the remote machine over SSH performance normally. If I execute the same in my local it's slowered but still usable. I guess that GitKraken makes more operations in the background which makes accumulated delays.

Is there a way to improve the performance or a better way to work with this requirements? Being able to use GitKraken and vsc locally.

I have already try several things like: mounting with systemd, sshfs, cleaning repositories with git gc, refreshing git indexes in my local machine (because the I've read It could influence the creation in CentOS vs Debian), improve NFS options and cache...

PS: I had a crazy idea to improve Git's performance. I created a Git alias on my local machine that first connects to the remote machine via SSH:

alias git=&#39;ssh -A &lt;user&gt;@&lt;host&gt; &quot;cd ${PWD} &amp;&amp; git&quot;&#39;

This significantly improved performance compared to using Git on NFS-mounted repositories.

While I know that there are probably ways to further improve performance using Git config proxies, and while this approach has its inconveniences, it was acceptable in my case. However, my main interest was in using GitKraken.

Since GitKraken uses its own Git implementation (libgit2), it does not rely on the Git installed on the bare machine. In that aspect, my hands are tied.

答案1

得分: 3

理想情况下,您应该仅在远程的 CentOS 机器上存储 仓库。
这样,您可以:

  • 在本地克隆它们
  • 在本地进行操作(通过 CLI 或 GitKraken 添加/提交/推送)
  • 推送回去

因此,您的日常操作大部分都会在本地进行。

英文:

Ideally, You would store only bare repositories on your remote CentOS machine.
That way, you can:

  • clone them locally
  • work locally (add/commit/push through CLI or GitKraken)
  • push back

Most of your day-to-day operation would therefore be local ones.

huangapple
  • 本文由 发表于 2023年3月31日 19:24:20
  • 转载请务必保留本文链接:https://go.coder-hub.com/75897979.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定