我能做些什么来加速createrepo?

我们正在使用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 

我能做些什么来加快速度?

dmourati在他的答案中给出的--cachedir选项会帮助你,但是你也应该使用--update ,特别是如果你不是一次性replace所有的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. 

此外,如果以这种方式进行部署,则考虑为此包制作一个单独的回购,这是真正的时间敏感性,并且 – 更新不够。

在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 。

您是否尝试过使用多核CPU的工具? 通常我使用–workers 4来产生4个createrepo线程

使用createrepo_c,C实现createrepo