Berkeley DB
From PostgreSQL 中文维基, PostgreSQL 中文站, PostgreSQL 中国社区, PostgreSQL Chinese community
[编辑] Transaction tuning
- access method
Queue > Btree > Hash >= Reco
- Btree database size
Btree 是 PageLevel 的锁定,因此 Page 越散,并发度越高
- DB_READ_UNCOMMITTED, DB_READ_COMMITTED
- DB_RMW
在 get 时,指定此 flag,表示马上需要 write。等于在 read 的时候拿到了一把写锁
- DB_TXN_WRITE_NOSYNC, DB_TXN_NOSYNC
这种方式可能会丢一部分数据,不过并发时不会损坏数据
- 顺序操作多个 db ,不要有来回操作
也就是在同一个事务中不要有 a==>b==>a 这样的路径
- 不要写入太大的 key-value
- mutex selection
单核系统上,pthread_mutex 优于 spin-lock。多核系统上反之。
- log file buffsize & log file 的物理存储位置与主文件分开
