我该怎么做才能加快createrepo?


8

我们正在使用yum存储库将软件分发到生产实例。不幸的是,createrepo成为瓶颈,我们的存储库中只有469个软件包。

$ time createrepo /opt/tm-yum-repo
Spawning worker 0 with 469 pkgs
Workers Finished
Gathering worker results

Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete

real    0m43.188s
user    0m37.798s
sys 0m1.296s

我该怎么做才能使其更快?


为什么createrepo时间很重要?
ewwhite

1
开发人员正在等待他们的代码发布。我们从“ rsync到live box”模型转变为rpm模型,他们抱怨现在需要几分钟,而以前则需要几秒钟。我有点同情他们的困境。但只有一点:)
jsd

感谢您的解释。我不知道这是否是一次延迟。
ewwhite

请发布您的“优化后”结果,以便我们查看优化节省了多少时间:)
Joshua Miller

使用选项“ --cachedir = cache --update --workers 4”将时间从50秒减少到15秒,这是巨大的胜利!伙计们,感谢您的有益建议!
jsd

Answers:


9

--cachedirdmourati在他的回答中提供的选项将对您有所帮助,但您也应该使用--update,特别是如果您不打算立即替换所有469个软件包。

       --update
              If metadata already exists  in  the  outputdir  and  an  rpm  is
              unchanged  (based on file size and mtime) since the metadata was
              generated, reuse the existing metadata rather than recalculating
              it.  In  the  case  of a large repository with only a few new or
              modified rpms this can significantly reduce I/O  and  processing
              time.

此外,如果以这种方式部署它确实对时间敏感,--update并且没有足够的帮助,请考虑为此程序包制作一个单独的存储库。


6

在createrepo联机帮助页中,您将看到cachedir的选项。

-c --cachedir <path>
              Specify a directory to use as a cachedir. This allows createrepo
              to create a cache of checksums of packages in the repository. In
              consecutive runs of createrepo over the same repository of files
              that  do  not  have  a  complete change out of all packages this
              decreases the processing time dramatically.

我从那里开始。

如果那不能充分地加快createrepo的速度,我将看一下SSD或tmpfs


4

您是否尝试过将--workers用于多核CPU?通常我使用--workers 4生成4个createrepo线程


By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.