Huge system slowdown while installing ports

Ryan Schmidt ryandesign at macports.org
Sat Jul 31 17:33:18 PDT 2010


On Jul 31, 2010, at 17:57, Haravikk wrote:

> I've actually always experienced this with Mac Ports, and I'm afraid I'm not sure what version I first tried, but when installing ports I often find that my system really crawls along at a snail's pace. Today I've spent nearly 13 hours installing the wine-devel port, even though kernel tasks (which I assume is the relevant process) has never gone beyond 15% CPU utilisation, yet light web surfing in Safari is sluggish, jerky, and sometimes unresponsive.
> 
> This is particularly annoying as I have an 8-core Mac Pro! There's plenty of CPU power remaining for other tasks, yet there's a bottleneck occurring somewhere because of MacPorts.
> 
> What I'd be interested in knowing is if there is anything I can do to debug and find whether this is occurring because of a conflict (besides turning things on and off please!) or how I might prevent it from happening.
> 
> I mean, is this occurring because everything is running under kernel tasks? If so, then is there a way to run it as its own independent process? I run MacPorts as root to ensure smooth installation, but I expect the bulk of the work could easily occur without root permissions, and without having anything to do with the kernel. Is this something I can change or a problem with MacPorts?
> 
> Not that this inconveniences me often, but I suspect that the pitiful CPU utilisation is why the ports take forever to build, and because they take forever to build my machine is slow for longer... well it's a vicious cycle, and it'd be nice if port updates could be snappier if it's at all possible =)

13 hours for wine-devel is excessive. My 3-year-old 2-core 2.2GHz MacBook Pro finishes it in well under an hour.

The amount of free memory and the percent of available disk space are relevant factors. Yesterday my system slowed to a crawl while compiling enblend, though the CPU was hardly busy at all. I discovered that there was a cc1plus process using 2GB RAM. (My machine has 4GB installed but I had many other programs open.), so free RAM was the limiting factor in this case (it was having to hit the hard drive for swap space, which, since my hard drive only has 10% free space and is likely highly fragmented, is slow).

MacPorts starts as many parallel jobs for compiling as it thinks will give good performance: 1 per core or 1 per GB of installed memory, whichever is less. But this rule of thumb is not always optimal. If you have more cores, you can often start more jobs than these; compiling most things does not need 1GB of memory. But, as enblend proved, sometimes it needs that much, or even much more, so starting fewer jobs is better. MacPorts also doesn't know what else is running on your machine at the time; perhaps you are already taxing your CPU, RAM or hard drive with other tasks and thus should start fewer jobs. You can control how many build jobs are started with the buildmakejobs setting in macports.conf or on the command line, e.g. "sudo port install wine-devel build.jobs=1".

You can also tell MacPorts to be "nice". That's the buildnicevalue setting in macports.conf. The default is 0, which tells MacPorts not to be nice -- that its compilations should get the same priority as other programs, which often slows them down. On all my MacPorts installations I set buildnicevalue to 10 (it doesn't really matter what value you use as long as it's greater than zero). This makes MacPorts compilations happen only when other programs aren't busy, which helps a lot.



More information about the macports-users mailing list