开启辅助访问 切换到宽版

精易论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

用微信号发送消息登录论坛

新人指南 邀请好友注册 - 我关注人的新帖 教你赚取精币 - 每日签到


求职/招聘- 论坛接单- 开发者大厅

论坛版规 总版规 - 建议/投诉 - 应聘版主 - 精华帖总集 积分说明 - 禁言标准 - 有奖举报

查看: 20133|回复: 301
收起左侧

[易源码分享] 基于Facebook开源的 rocksdb 分布式数据库模块 [迭代]

    [复制链接]
结帖率:100% (1/1)
发表于 2023-9-21 18:24:58 | 显示全部楼层 |阅读模式   广东省深圳市
分享源码
界面截图:
是否带模块: 调用了模块
备注说明: -

1695289508782766.png
由于之前帖子内容太多,这里重新发布一篇,之前帖子地址--> 地址


什么是rocksdb?
  • RocksDB是一个 持久的键值存储库 ,它是用C++编写的,适合在快速、低延迟的存储设备上存储数据。它是由Facebook数据库工程团队开发和维护。

LevelDB 有什么区别?
  • RocksDB和LevelDB都是基于LSM-Tree的嵌入式键值存储库,但RocksDB是在LevelDB的基础上进行了优化和增强


  • RocksDB可以支持 多线程 合并文件,而LevelDB是 单线程
  • RocksDB可以根据需要开辟 多个Memtable ,而LevelDB只有 一个Memtable
  • RocksDB可支持多种压缩算法,而LevelDB只支持snappy
  • 单线程模式下 LevelDB 可能稍微快一点,而在多线程下 RocksDB 就会发挥出它的优势了


rocksdb的优点
  • 高性能:RocksDB 使用了很多优化技术,如多线程、高效的数据结构等,因此具有非常高的读写性能。
  • 可扩展性:RocksDB 可以处理大规模的数据,并支持自动分片和负载均衡等功能,因此可以很好地应对高并发访问。
  • 可靠性:RocksDB 支持 ACID 事务,保证数据的一致性和可靠性。
  • 灵活性:RocksDB 支持多种数据格式,包括内存映射文件、纯内存等,让用户可以灵活选择适合自己的存储方式。
  • RocksDB在存储数据时是按照键的排序方式进行存储的,它并没有明确的容量限制,可以存储非常大的数据 [理论上无限制容量]。而类似MMKV框架限制容量的方式是使用了一种固定大小的映射文件,即在创建MMKV实例时就已经确定了最大容量,超过容量时就不能再写入数据[大概在 4GB 左右]




下图为 rocksdb和leveldb  单/多线程 写入对比
理论上在单线程下 RocksDB应该比levldb稍微略慢一点
图中可看到300W多线程写入RocksDB一瞬间完成








OR6KN6SFYP9L79F.png




解压密码:neko
另外发布了一份火山版rocksdb







更新日志  2023/09/21 18:00  - V1.5  本次更新内容有点多

  • 本次使用了C++ MT 模式编译
  • 增加 Transaction事务类   (此事务支持在事务内创建迭代器,支持事务读取回滚操作)
  • 增加 OptimisticTransactionDB_类
  • 增加 TransactionDB (TransactionDB(PessimisticTransactionDB)和OptimisticTransactionDB,分别对应并发控制中的悲观锁和乐观锁)
  • 增加 Merge 合并功能   (使用此命令前务必在 rocksdb_启动参数 的 合并模式 选择合并模式)
  • 修复 压缩模式 无效
  • 修复 关闭写前日志 无效    (如果想完全启用内存模式,请将缓存调大关闭写前日志开启 即可)
  • OptimisticTransactionDBTransactionDB  对应的事务 [Transaction事务类]
  • ...



  • 以下为Facebook官方更新
  • -Please note 8.5.1 includes a fix for a persisted database corruption in an unlikely edge case. Upgrading to a version including this fix, like this one, is highly recommended!
  • Fixed a race condition in GenericRateLimiter that could cause it to stop granting requests
  • Fix a bug where iterator may return incorrect result for DeleteRange() users if there was an error reading from a file.
  • Fix a bug where if there is an error reading from offset 0 of a file from L1+ and that the file is not the first file in the sorted run, data can be lost in compaction and read/scan can return incorrect results.



  • https://wwqr.lanzouw.com/b09ivrlpc
  • 密码:7l4b




点评

牛逼,收藏了!Q!!Q   河南省洛阳市  发表于 2023-9-23 08:49

评分

参与人数 27好评 +13 精币 +34 收起 理由
情殇 + 1 + 2 支持开源~!感谢分享
默念、 + 1 + 1 YYDS~!
单排练心态 + 1 + 1 普通写入10w次失败,其他功能测试都正常。
t176 + 1 感谢分享,很给力!~
116154801 + 1 开源精神必须支持~
3266167 + 1 感谢分享,很给力!~
Sunnnny + 1 + 2 支持开源~!感谢分享
三千年i + 1 感谢分享,很给力!~
斩月Aphack + 1 + 2 感谢分享,很给力!~
最后一抹笑 + 1 支持开源~!感谢分享
XXGL2005 + 1 感谢分享,很给力!~
mypursue + 1 感谢分享,很给力!~
木小果 + 1 + 2 YYDS~!
cp3279559 + 1 感谢分享,很给力!~
易语言资源网 + 1 + 3 开源精神必须支持~
ican8 + 1 感谢分享,很给力!~
keyi5566 + 1 感谢分享,很给力!~
无尘666 + 1 感谢分享,很给力!~
pj小黑屋 + 1 感谢分享,很给力!~
booms + 1 感谢分享,很给力!~
qiyuer + 1 感谢分享,很给力!~
※逍遥游※ + 1 感谢分享,很给力!~
光影魔术 + 1 + 2 感谢发布原创作品,精易因你更精彩!
果心豆腐酱 + 1 没有例子,不会用,再快也没用,都看不懂干嘛用的。
文西哥 + 1 + 3 支持开源~!感谢分享
xjdgs + 1 + 2 建议做个模拟数据库操作类的例子让大家熟悉点
壮志豪情 + 1 开源精神必须支持~

查看全部评分


本帖被以下淘专辑推荐:

结帖率:100% (1/1)

签到天数: 9 天

 楼主| 发表于 2023-9-23 10:44:53 | 显示全部楼层   广东省深圳市
本帖最后由 Buei 于 2023-9-23 10:48 编辑

问题反馈/交流Q群

Q群

Q群
回复 支持 反对

使用道具 举报

结帖率:100% (1/1)

签到天数: 9 天

 楼主| 发表于 2023-11-28 15:27:25 | 显示全部楼层   广东省深圳市
本帖最后由 Buei 于 2023-11-28 22:26 编辑



更新日志  2023/11/28 15:00  - V1.6 [rocksdb内核版本:8.8.1]

增加 设置  预读取缓存大小 [默认未开启
增加 设置  可见性等级  
增加 设置  日志备份次数 [LOG.old 开头的文件每次启动数据库时备份次数]
增加 自定义日志目录
修复 当value为空时写入失败
...



以下为Facebook官方更新日志

8.8.1 (2023-11-17)Bug fixes
  • Make the cache memory reservation accounting in Tiered cache (primary and compressed secondary cache) more accurate to avoid over/under charging the secondary cache.
  • Allow increasing the compressed_secondary_ratio in the Tiered cache after setting it to 0 to disable.
8.8.0 (2023-10-23)New Features
  • Introduce AttributeGroup by adding the first AttributeGroup support API, MultiGetEntity(). Through the use of Column Families, AttributeGroup enables users to logically group wide-column entities. More APIs to support AttributeGroup will come soon, including GetEntity, PutEntity, and others.
  • Added new tickers rocksdb.fifo.{max.size|ttl}.compactions to count FIFO compactions that drop files for different reasons
  • Add an experimental offpeak duration awareness by setting DBOptions::daily_offpeak_time_utc in "HH:mm-HH:mm" format. This information will be used for resource optimization in the future
  • Users can now change the max bytes granted in a single refill period (i.e, burst) during runtime by SetSingleBurstBytes() for RocksDB rate limiter
Public API Changes
  • The default value of DBOptions::fail_if_options_file_error changed from false to true. Operations that set in-memory options (e.g., DB::Open*(), DB::SetOptions(), DB::CreateColumnFamily*(), and DB::DropColumnFamily()) but fail to persist the change will now return a non-OK Status by default.
  • Add new Cache APIs GetSecondaryCacheCapacity() and GetSecondaryCachePinnedUsage() to return the configured capacity, and cache reservation charged to the secondary cache.
Behavior Changes
  • For non direct IO, eliminate the file system prefetching attempt for compaction read when Options::compaction_readahead_size is 0
  • During a write stop, writes now block on in-progress recovery attempts
  • Deleting stale files upon recovery are delegated to SstFileManger if available so they can be rate limited.
Bug Fixes
  • Fix a bug in auto_readahead_size where first_internal_key of index blocks wasn't copied properly resulting in corruption error when first_internal_key was used for comparison.
  • Fixed a bug where compaction read under non direct IO still falls back to RocksDB internal prefetching after file system's prefetching returns non-OK status other than Status::NotSupported()
  • Add bounds check in WBWIIteratorImpl and make BaseDeltaIterator, WriteUnpreparedTxn and WritePreparedTxn respect the upper bound and lower bound in ReadOption. See 11680.
  • Fixed the handling of wide-column base values in the max_successive_merges logic.
  • Fixed a rare race bug involving a concurrent combination of Create/DropColumnFamily and/or Set(DB)Options that could lead to inconsistency between (a) the DB's reported options state, (b) the DB options in effect, and (c) the latest persisted OPTIONS file.
  • Fixed a possible underflow when computing the compressed secondary cache share of memory reservations while updating the compressed secondary to total block cache ratio.
Performance Improvements
  • Improved the I/O efficiency of DB::Open a new DB with create_missing_column_families=true and many column families.



  • https://wwqr.lanzouw.com/b09ivrlpc
  • 密码:7l4b



评分

参与人数 1好评 +1 精币 +3 收起 理由
文西哥 + 1 + 3 支持开源~!感谢分享

查看全部评分

回复 支持 1 反对 0

使用道具 举报

结帖率:100% (1/1)

签到天数: 2 天

发表于 2024-5-1 20:23:49 | 显示全部楼层   广东省广州市
这个666666666666666666666
回复 支持 反对

使用道具 举报

签到天数: 7 天

发表于 2024-2-25 19:16:22 | 显示全部楼层   浙江省温州市
        感谢分享,很给力!~
回复 支持 反对

使用道具 举报

结帖率:0% (0/3)

签到天数: 11 天

发表于 2024-2-4 11:56:29 | 显示全部楼层   辽宁省大连市
感谢分享,很给力!~
回复 支持 反对

使用道具 举报

签到天数: 6 天

发表于 2024-1-23 12:18:51 | 显示全部楼层   广东省湛江市
支持支持支持支持支持支持支持支持支持支持支持支持支持支持支持支持支持
回复 支持 反对

使用道具 举报

签到天数: 1 天

发表于 2024-1-22 20:50:39 | 显示全部楼层   上海市上海市
666666666666666666666666666666666
回复 支持 反对

使用道具 举报

发表于 2024-1-22 16:41:43 | 显示全部楼层   浙江省杭州市
感谢分享,很给力!~
回复 支持 反对

使用道具 举报

发表于 2024-1-17 16:00:52 | 显示全部楼层   浙江省杭州市
感谢分享,很给力!~
回复 支持 反对

使用道具 举报

发表于 2024-1-13 09:04:11 | 显示全部楼层   浙江省杭州市
感谢分享,很给力!~
回复 支持 反对

使用道具 举报

发表于 2024-1-10 08:11:50 | 显示全部楼层   山东省临沂市
支持开源~!感谢分享
回复 支持 反对

使用道具 举报

结帖率:93% (14/15)

签到天数: 3 天

发表于 2024-1-4 21:57:50 | 显示全部楼层   广东省深圳市
感谢分享了
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则 致发广告者

发布主题 收藏帖子 返回列表

sitemap| 易语言源码| 易语言教程| 易语言论坛| 诚聘英才| 易语言模块| 手机版| 广告投放| 精易论坛
拒绝任何人以任何形式在本论坛发表与中华人民共和国法律相抵触的言论,本站内容均为会员发表,并不代表精易立场!
论坛帖子内容仅用于技术交流学习和研究的目的,严禁用于非法目的,否则造成一切后果自负!如帖子内容侵害到你的权益,请联系我们!
防范网络诈骗,远离网络犯罪 违法和不良信息举报电话0663-3422125,QQ: 800073686,邮箱:800073686@b.qq.com
Powered by Discuz! X3.4 揭阳市揭东区精易科技有限公司 ( 粤ICP备12094385号-1) 粤公网安备 44522102000125 增值电信业务经营许可证 粤B2-20192173

快速回复 返回顶部 返回列表