What can I do to speed up createrepo?

jsd asked:

We are using a yum repository to distribute our software to our production instances. Unfortunately, createrepo is becoming a bottleneck, and we only have 469 packages in the repository.

$ 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

What can I do to make it faster?

My answer:

The --cachedir option given by dmourati in his answer will help you, but you should also use --update, especially if you are not replacing all 469 packages at once.

              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

In addition, consider making a separate repo for this package if deploying it this way is truly time-sensitive and --update doesn’t help enough.

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.