monetto

ES 从 File System Cache 到 Segment 大概会耗时多少呢

  •  
  •   monetto · Aug 25, 2022 · 4560 views
    This topic created in 1355 days ago, the information mentioned may be changed or developed.

    看 ES 原理,有一段大致是这样介绍的。

    ES 将数据写入到 Memory Buffer ,同时也会将数据写入到 Translog 。

    Memory Buffer 在历经 Refresh Interval ( 1 秒) 之后会把数据写入到 File System Cache ,再由 File System Cache 写入到 Segment 。

    而 数据写入到 Translog 之后,要经过 5 秒 才会持久化到磁盘 log 中。

    我理解 Translog 本身应该是类似于 MySQL Binlog 一样是防止数据丢失的。

    但是目前看来 5s 的时间是否过长了,我理解 5s 怎么也完成 数据 从 内存 持久化 到 Segment 了啊..

    4 replies    2022-08-26 11:51:58 +08:00
    1018ji
        1
    1018ji  
       Aug 25, 2022
    https://www.cnblogs.com/huss2016/p/14706326.html

    不知道对不对,你瞅瞅吧
    q474818917
        2
    q474818917  
       Aug 25, 2022
    这应该是定时频率,类似 mysql 的 redo log
    anjiannian
        3
    anjiannian  
       Aug 26, 2022 via Android
    数据在写入 file system cache 和 segment 后仍然在内存中没有落盘的,数据落盘是根据 translog 的大小 index.translog.flush_threshold_size 或者 30 分钟才会触发 flush 操作
    LeegoYih
        4
    LeegoYih  
       Aug 26, 2022
    可以将 translog 设置成每次写操作直接 fsync 到磁盘,但是性能会差很多。

    Elasticsearch 作为搜索引擎,不应该用数据库的思路来使用,牺牲一点点一致性保证可用性是可以理解的,如果发生崩溃故障,可以手动触发同步宕机前一段时间的数据
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3352 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 00:31 · PVG 08:31 · LAX 17:31 · JFK 20:31
    ♥ Do have faith in what you're doing.