我知道 MySQL ,RocksDB 等数据库其实都有 WAL ,但同样地都依赖操作系统定期将内存缓存中的数据通过 fsync()刷回磁盘。如果此时断电(或者操作系统崩溃),1 秒内的数据可能会丢失。
MySQL:innodb_flush_log_at_trx_commit
https://dba.stackexchange.com/questions/12611/is-it-safe-to-use-innodb-flush-log-at-trx-commit-2
The default value of 1 is required for full ACID compliance. You can achieve better performance by setting the value different from 1, but then you can lose up to one second worth of transactions in a crash. With a value of 0, any mysqld process crash can erase the last second of transactions. With a value of 2, only an operating system crash or a power outage can erase the last second of transactions. InnoDB’s crash recovery works regardless of the value.
所以似乎为了数据完备性,innodb_flush_log_at_trx_commit=1 是不可避免的,从而会导致比较严重的性能劣势。
例如 LevelDB ,开启 WriteOptions(Sync=true)后,tps 从 190000/s 骤降为 1200/s.
Qwen3 的一个回答: https://chat.qwen.ai/s/0e7d9977-4400-41da-883f-2972893104cf?fev=0.0.85
想请教一下大家,在对数据完备性要求极高的场景下,大家是怎么优化性能的?
6 条回复 • 2025-04-29 14:49:39 +08:00
![]() |
1
13 分钟前 应急电源啊
|
![]() |
2
13 分钟前 UPS 保平安
|
![]() |
3
12 分钟前 金融系统连 UPS 都没一个吗?
|
![]() |
4
10 分钟前 看你是上游还是下游,如果是下游,可以起一个重发的信号
|
![]() |
5
8 分钟前 如果是交易所,比如是上交所 ,你可以去搜索上交所 ups 电源 结果就是:UPS+柴发
证券技术大厦共 10 层,其中地上 8 层,可提供超过 6000 平米的托管机房,采用双路独立的市政电源作为常用电源,配备了 2N 的 UPS 及 N+1 冗余柴发作为备用电源。 |
![]() |
6
2 分钟前 银行都是异地多活,多可用区(独立供网供电,独立 ups 电源)。内存都已经可以当硬盘用
|