Tech Info 129: File I/O performance workaround for HELIOS UB2 server on 10.6

HELIOS Tech Info #129

========================================================

Update (Mon, 1 Aug 2011):

This problem has been resolved in Mac OS X 10.7 by Apple.

 

Update (Wed, 22 May 2013):
We got a customer report that modifying “/etc/rc.common” no longer works after the latest Mac OS X 10.6 security updates. We recommend to upgrade to Mac OS X 10.7 or later.

========================================================

Mon, 14 Feb 2011

File I/O performance workaround for HELIOS UB2 server on 10.6

We noticed a Mac OS X 10.6 bug (Mac OS X 10.5 works fine) causing some services or command line tools work really slow and use much CPU load.
We examined this problem and found a slow system call handling for the “mmap/munmap” calls.

As a workaround for this problem we implemented the possibility to optionally disable the “mmap/munmap” usage via the “SFIO_NOMMAP” environment variable.
 

To enable the “SFIO_NOMMAP” environment variable for all HELIOS services, add the following lines to “/etc/rc.common”

# prevent mmap usage for the HELIOS Services

# running on Mac OS X 10.6

SFIO_NOMMAP=1

export SFIO_NOMMAP

After this change the Mac must be rebooted.

This bug still exists in the current Mac OS X 10.6.6 release.

We will update this Tech Info as soon as a fix is available for this problem.
 

The following example illustrates the bug using the “dt” command

1. Create an 1 GB file using “dd”:

$ dd if=/dev/random of=foo bs=1024k count=1024

2. Copy this file using “dt”:

$ time /usr/local/helios/bin/dt cp foo bar

real    7m25.756s

user    0m0.930s

sys    5m59.425s

As result this file copy of an 1 GB file is really slow and “dt” utilizes full CPU while running!

3. Disable the “mmap/munmap” usage and call “dt” again:

$ SFIO_NOMMAP=1;export SFIO_NOMMAP
$ time /usr/local/helios/bin/dt cp foo bar
real    0m40.406s
user    0m0.012s
sys    0m2.612s

As result this call is much faster and uses much less CPU.