Some random ideas which mizdebsk uses to improve performance of his workflow with mock.
Rebuild your root cache often (at leats once a day)
# rm -rf /var/cache/mock/CONFIG/root_cache $ mock -r CONFIG init
You can have a cron job that will do this for all your configs at, let's say, 6 AM, before you start work.
Use lzop for compression instead of pigz
# yum install -y lzop
in mock.cfg add:
config_opts['plugin_conf']['root_cache_opts']['compress_program'] = 'lzop'
Disable "yum update"
If you reinit root cache often enough then you don't need mock to run yum update every time, it's just waste of time. In file /usr/lib/python2.7/site-packages/mockbuild/backend.py find lines:
if self.chrootWasCached: self._yum(('update',), returnOutput=1)
and remove them (or comment out)
Use different "profiles" for building different kind of packages. For example if build Java packages often then have a mock config "maven.cfg" with:
config_opts['chroot_setup_cmd'] = 'install @buildsys-build maven'
and another for ant
config_opts['chroot_setup_cmd'] = 'install @buildsys-build ant'
and another for eclipse:
config_opts['chroot_setup_cmd'] = 'install @buildsys-build maven eclipse-platform'
and so on...
Use squid cache server.
- Mock by default uses separate yum caches for separate configs. You could use shared yum cache for more than one mock config, but that only causes concurrency problems. Squid cache solves that issue.
- Default squid config isn't quite good for this purpose, so take your time and configure squid properly (for eg. IIRC default object size is to small).
- Use one squid cache for your machine / home / orgamization instead of multiple instances (each per virtual machine etc.)
Don't use mirrorlist in your yum.conf, use baseurl with a single server.
- single server has a great synergy with squid, mirrorlist works much worse.
Set debuglevel=2 instead of default debuglevel=1.
- Not really a speed improvement, but this increases verbosity and lets you know whats the progress and lets you plan your time a bit better, which in turn is a speed improvement :)
- You can often discover random RPM scriplet failures by increasing verbosity, so just do this. It's unknown why 1 is default, in mizdebsk opinion it should definitely be 2.
Mount /var/lib/mock/CONFIG as tmpfs (or symlink to a subdirectory under /dev/shm)