我可以做些什么来加速 createrepo?

jsd*_*jsd 9 yum rpm

我们正在使用 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
Run Code Online (Sandbox Code Playgroud)

我该怎么做才能让它更快?

Mic*_*ton 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.
Run Code Online (Sandbox Code Playgroud)

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


dmo*_*ati 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.
Run Code Online (Sandbox Code Playgroud)

我会从那里开始。

如果这不能充分加快 createrepo 的速度,我会查看 SSD 或tmpfs


Shâ*_*hắc 5

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