bdb log file 预设长度的性能优化
postgres 同理的code:
backend/cdb/cdblogsync.c, createZeroFilledNewFile()
/*
* Zero-fill the file. We have to do this the hard way to ensure that all
* the file space has really been allocated --- on platforms that allow
* "holes" in files, just seeking to the end doesn't allocate intermediate
* space. This way, we know that we have all the space and (after the
* fsync below) that all the indirect blocks are down on disk. Therefore,
* fdatasync(2) or O_DSYNC will be sufficient to sync future writes to the
* log file.
*/
MemSet(zbuffer, , sizeof(zbuffer));
看代码随手记:log_put.c, __log_write()
/*
* If we're writing the first block in a log file on a filesystem that
* guarantees unwritten blocks are zero-filled, we set the size of the
* file in advance. This increases sync performance on some systems,
* because they don't need to update metadata on every sync.
*
* Ignore any error -- we may have run out of disk space, but that's no
* reason to quit.
*/
#ifdef HAVE_FILESYSTEM_NOTZERO
if (lp->w_off == && !__os_fs_notzero()) {
#else
if (lp->w_off == ) {
#endif
(void)__db_file_extend(env, dblp->lfhp, lp->log_size);
if (F_ISSET(dblp, DBLOG_ZERO))
(void)__db_zero_extend(env, dblp->lfhp,
, lp->log_size/lp->buffer_size, lp->buffer_size); }
我的理解:在flush log时使用fdatasync, 若log文件长度发生变化, 则仍需要写文件 metadata。
https://linux.die.net/man/2/fdatasync
fdatasync() is similar to fsync(), but does not flush modified metadata unless that metadata is needed in order to allow a subsequent data retrieval to be correctly handled. For example, changes to st_atime or st_mtime (respectively, time of last access and time of last modification; see stat(2)) do not require flushing because they are not necessary for a subsequent data read to be handled correctly. On the other hand, a change to the file size (st_size, as made by say ftruncate(2)), would require a metadata flush.
bdb log file 预设长度的性能优化的更多相关文章
- oracle之 等待事件LOG FILE SYNC (awr)优化
log file sycn是ORACLE里最普遍的等待事件之一,一般log file sycn的等待时间都非常短 1-5ms,不会有什么问题,但是一旦出问题,往往都比较难解决.什么时候会产生log f ...
- hbase性能优化总结
hbase性能优化总结 1. 表的设计 1.1 Pre-Creating Regions 默认情况下,在创建HBase表的时候会自动创建一个region分区,当导入数据的时候,所有的HBase客户端都 ...
- 完全揭秘log file sync等待事件-转自itpub
原贴地址:http://www.itpub.net/thread-1777234-1-1.html 谢谢 guoyJoe 老大 这里先引用一下tanel poder大师的图: 什么是log fil ...
- Android性能优化问题总结
性能优化这块,分为UI性能优化.内存优化.数据库优化.网络优化.耗电优化等等.可以从1.如何发现问题,2.怎么解决问题,3.解决效果对比,这几个方面去描述.举个简单例子——UI优化,可以从 UI出现什 ...
- 理解LGWR,Log File Sync Waits以及Commit的性能问题[转]
理解LGWR,Log File Sync Waits以及Commit的性能问题 一.概要: 1. Commit和log filesync的工作机制 2. 为什么log file wait太久 3. ...
- RAC 性能分析 - 'log file sync' 等待事件
简介 本文主要讨论 RAC 数据库中的'log file sync' 等待事件.RAC 数据库中的'log file sync' 等待事件要比单机数据库中的'log file sync' 等待事件复杂 ...
- Oracle之 等待事件log file sync + log file parallel write (awr优化)
这是3月份某客户的情况,原因是server硬件故障后进行更换之后,业务翻译偶尔出现提交缓慢的情况.我们先来看下awr的情况. 我们能够看到,该系统的load profile信息事实上并不高,每秒才21 ...
- Java程序性能优化Tip
本博客是阅读<java time and space performance tips>这本小书后整理的读书笔记性质博客,增加了几个测试代码,代码可以在此下载:java时空间性能优化测试代 ...
- mysql数据库性能优化(包括SQL,表结构,索引,缓存)
优化目标减少 IO 次数IO永远是数据库最容易瓶颈的地方,这是由数据库的职责所决定的,大部分数据库操作中超过90%的时间都是 IO 操作所占用的,减少 IO 次数是 SQL 优化中需要第一优先考虑,当 ...
随机推荐
- Endless Sky源码学习笔记-2
数据载入框架: void GameData::BeginLoad(const char * const *argv)为数据载入的最上层method,其主要框架为: void Files::Init(c ...
- python时间函数学习
格式化当前日期: import time print time.strftime('%Y-%m-%d') 获取一天前的日期: import datetime import time onedayago ...
- 《西科软件》一个高级PHP工程师所应该具备的
初次接触PHP,就为他的美所折服,于是一发不可收拾.很多面试,很多人员能力要求都有"PHP高级工程师的字眼",如果您真心喜欢PHP,并且您刚起步,那么我简单说说一个PHP高级工程师 ...
- 通过RGB灯输出七色
本文由博主原创,如有不对之处请指明,转载请说明出处. /********************************* 代码功能:输出模拟信号,控制RGB灯的颜色 使用函数: pinMode(引脚 ...
- install LLVM
version >= 3.8.0 $ cd llvm... $ mv someofClang ./tools $ mkdir build $ cd build $ cmake -DCMAKE_B ...
- SSH的端口转发:本地转发Local Forward和远程转发Remote Forward
关于使用ssh portforwarding来进行FQ的操作,网络上已经有很多很好的文章,我在这里只是画两个图解释一下. 首先要记住一件事情就是: SSH 端口转发自然需要 SSH 连接,而 SSH ...
- jQuery停止动画——stop()方法的使用
很多时候需要停止匹配元素正在进行的动画,比如,当鼠标选入元素时显示菜单,鼠标离开时隐藏下拉菜单,如果鼠标移入移出过快的话就会导致动画效果与鼠标的动作不一致的情况,此时stop()就派上用场了. sto ...
- android:ems的作用
android:ems用来设置EditText或TextView显示的字符宽度. 比如:android:ems="10" 设置TextView或EditText为10个字符的宽度, ...
- php 连接 mssql 常见的所有问题
php连接mssql时 ntwdblib.dllPHP连接MSSQL配置和PHP代码演示 收藏 如果实现了PHP和MySQL链接了,PHP和MSSQL的链接其实很简单: 支持MSSQL的本地链接和远程 ...
- AngularJs自定义指令详解(10) - 执行次序
代码: <!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8 ...