pagesize.so
来自「berkeley db 4.6.21的源码。berkeley db是一个简单的数」· SO 代码 · 共 80 行
SO
80 行
m4_comment([$Id: pagesize.so,v 10.22 2002/02/11 14:55:53 bostic Exp $])m4_ref_title(Access Methods, Selecting a page size, selecting a @page size, am_conf/logrec, am_conf/cachesize)m4_p([dnlThe size of the pages used in the underlying database can be specified bycalling the m4_refT(dbh_set_pagesize). The minimum page size is 512 bytesand the maximum page size is 64K bytes, and must be a power of two. Ifno page size is specified by the application, a page size is selectedbased on the underlying filesystem I/O block size. (A page size selectedin this way has a lower limit of 512 bytes and an upper limit of 16Kbytes.)])m4_p([dnlThere are several issues to consider when selecting a pagesize: overflowrecord sizes, locking, I/O efficiency, and recoverability.])m4_p([dnlFirst, the page size implicitly sets the size of an overflow record.Overflow records are key or data items that are too large to fit on anormal database page because of their size, and are therefore stored inoverflow pages. Overflow pages are pages that exist outside of the normaldatabase structure. For this reason, there is often a significantperformance penalty associated with retrieving or modifying overflowrecords. Selecting a page size that is too small, and which forces thecreation of large numbers of overflow pages, can seriously impact theperformance of an application.])m4_p([dnlSecond, in the Btree, Hash and Recno access methods, the finest-grainedlock that m4_db acquires is for a page. (The Queue access methodgenerally acquires record-level locks rather than page-level locks.)Selecting a page size that is too large, and which causes threads orprocesses to wait because other threads of control are accessing ormodifying records on the same page, can impact the performance of yourapplication.])m4_p([dnlThird, the page size specifies the granularity of I/O from the databaseto the operating system. m4_db will give a page-sized unit of bytes tothe operating system to be scheduled for reading/writing from/to thedisk. For many operating systems, there is an internal m4_bold(blocksize) which is used as the granularity of I/O from the operating systemto the disk. Generally, it will be more efficient for m4_db to writefilesystem-sized blocks to the operating system and for the operatingsystem to write those same blocks to the disk.])m4_p([dnlSelecting a database page size smaller than the filesystem block sizemay cause the operating system to coalesce or otherwise manipulate m4_dbpages and can impact the performance of your application. When the pagesize is smaller than the filesystem block size and a page written bym4_db is not found in the operating system's cache, the operating systemmay be forced to read a block from the disk, copy the page into theblock it read, and then write out the block to disk, rather than simplywriting the page to disk. Additionally, as the operating system isreading more data into its buffer cache than is strictly necessary tosatisfy each m4_db request for a page, the operating system buffer cachemay be wasting memory.])m4_p([dnlAlternatively, selecting a page size larger than the filesystem blocksize may cause the operating system to read more data than necessary.On some systems, reading filesystem blocks sequentially may cause theoperating system to begin performing read-ahead. If requesting a singledatabase page implies reading enough filesystem blocks to satisfy theoperating system's criteria for read-ahead, the operating system may domore I/O than is required.])m4_p([dnlFourth, when using the m4_tam product, the page size may affect the errorsfrom which your database can recover Seem4_link(M4RELDIR/ref/transapp/reclimit, [m4_db Recoverability]) for moreinformation.])m4_page_footer
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?