[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: shared memory vs memory mapped files

Quanah Gibson-Mount wrote:
--On Wednesday, February 18, 2009 12:26 AM +1000 "Brett @Google"
<brett.maxfield@gmail.com>  wrote:

I note the benchmark files from Symas use memory mapped files, so i'm
assuming there is a clear performance benefit, is this true ?


That was a bit vague. There is no special benefit to using memory mapped files. On some systems there is a benefit to using a shared memory key.

So if there is a clear query performance or other benefit, is there any
additional risk of corruption over memory mapped files (vs. the 25% load
speed improvement) ?

There is no risk of corruption as long as the disk holding your transaction log files doesn't crash.

When I did those tests for Symas, shm keys at the time made a substantial
difference on Solaris only.  That was with BDB 4.2&  OpenLDAP 2.3 however.
With BDB 4.7.25&  OpenLDAP 2.4, they seem to make an impressive difference
on Linux as well.

The fact that the behavior of memory mapped files varies from platform to platform is annoying enough to me that I use shm all the time now. There's only one slight downside: after a shutdown, obviously the shm contents disappear, so on the next reboot, you start with a cold cache. With mmap'd files, the BDB cache persists through reboots, and so it's possible that its initial performance will be faster. But the runtime performance of shm far outweighs that factor.
-- Howard Chu
CTO, Symas Corp. http://www.symas.com
Director, Highland Sun http://highlandsun.com/hyc/
Chief Architect, OpenLDAP http://www.openldap.org/project/