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

Re: BerkeleyDB performance on Linux

Rick Jones wrote:
Howard Chu wrote:
The attached patch makes O_DIRECT work on Linux in BerkeleyDB 4.5.20. (You will need to manually define LINUX_NEEDS_PAGE_ALIGNMENT if you're using a kernel older than 2.6.)

The main reason to use this patch is to conserve memory - ordinarily, all the I/O that BDB does to its files gets cached in the Linux filesystem buffer cache. This caching is redundant since BDB always does its own caching, and it effectively makes the BDB environment consume twice as much memory as it needs. Using O_DIRECT on I/Os disables the filesystem buffer cache for those I/Os, thus freeing up a sizable chunk of memory.

Long ago and far away I was having "fun" with SPECweb99 on Linux and found that eventually the access logs would grow and cast-out otherwise usefully cached URLs. I then found the posix_fadvise call, which can be used to tell the system that a certain range is no longer required:

Yes, but posix_fadvise is not supported on Linux kernels before 2.6, returns ENOSYS.

  -- Howard Chu
  Chief Architect, Symas Corp.  http://www.symas.com
  Director, Highland Sun        http://highlandsun.com/hyc
  OpenLDAP Core Team            http://www.openldap.org/project/