Hard commits, soft commits and transaction logs
“Hard commits are about durability, soft commits are about visibility“
Transaction Logs
首先介绍下solrcloud的index流程。
1)update请求发送给任意节点(NodeA)。
2)若该节点不是leader,将请求转发给leader。
3)leader将请求转发给所有副本节点(同一分片)。
后面就是执行结果的响应(response),所有副本节点反馈给leader,leader再反馈给原接收到请求的节点(NodeA)。
当所有leader都反馈给NodeA(执行update完毕),NodeA再反馈给“客户端”。在这时候,所有的更新操作被刷到tlog中。
如果JVM挂了,这些操作任然会被写入磁盘,如果操作系统挂了,就会丢掉这些操作日志。
如果JVM重启,那么solr会从tlog中进行数据恢复。
注意:
1)hard commit时产生一个新的tlog文件,如果被关闭的tlog中包含的documents超过100,则会删除最老的一个tlog文件。
e.g.
So consider if you are indexing in batches of 25 documents and hard committing after each one (not that you should commit that often, but just saying). You should have 5 tlogs at any given time. the oldest four (closed) contain 25 documents each, totaling 100 plus the current tlog file. When the current tlog is closed, the oldest tlog will be deleted, and a new one opened.
2)如果一直没有hard commit,那么这个tlog文件可能会很大(一直没有close)。当solr重启的时候可能会造成较大的性能消耗。
Soft commit
Soft commit让searcher对更新可见,但是会导致“top level caches”失效(filterCache、queryResultCache等),包括FieldValueCache失效,那么facet请求需要等待cache完成刷新。
如果频繁的soft commit会导致“top level caches”很少被命中,导致性能问题。
不过“segment level caches”并不会失效,例如function queries、sorting caches等。
Soft commit到底做了些什么?
1)tlog会持续被写入,并不会重新创建。
2)searcher对更新可见。
3)一些cache会被重新加载(top level caches)
虽然soft commit比hard commit更轻量,但是TANSTAAFL,There Ain't No Such Thing As A Free Lunch. Soft commit支持nrt,不过也需要额外的开销,这取决于你系统对nrt的忍耐度。
Hard commit
Hard commit到底做了什么?
1)创建新的tlog,如果超过100个documtns,那么就会删除老的tlog文件。
2)创建新的segment,并flush到磁盘。
3)segment合并有可能会被触发。
Hard commit还有一个选项:openSearcher。
openSearcher=true
Searchers会被重新打开,并且所有caches会失效,执行自动预热。只有这样才能对更新可见。
openSearcher=false
更新不可见。
简单的总结:
SoftCommit:更新可见,缓存失效,不会写入磁盘,追加tlog。
HardCommit:更新不可见,写入磁盘,新建tlog。
https://lucidworks.com/blog/understanding-transaction-logs-softcommit-and-commit-in-sorlcloud/
Hard commits, soft commits and transaction logs的更多相关文章
- mkdir: cannot create directory ‘/soft/hadoop-2.7.3/logs’: Permission denied问题
启动hadoop时,报错“mkdir: cannot create directory ‘/soft/hadoop-2.7.3/logs’: Permission denied” 注:/soft/ha ...
- Solr Cloud - SolrCloud
关于 Solr Cloud Zookeeper 入门,介绍 原理 原封不动转自 http://wiki.apache.org/solr/SolrCloud/ ,文章的内存有些过时,但是了解原理. Th ...
- Java性能提示(全)
http://www.onjava.com/pub/a/onjava/2001/05/30/optimization.htmlComparing the performance of LinkedLi ...
- Microsoft SQL Server Trace Flags
Complete list of Microsoft SQL Server trace flags (585 trace flags) REMEMBER: Be extremely careful w ...
- What is SolrCloud? (And how does it compare to master-slave?)
What is SolrCloud? (And how does it compare to master-slave?) SolrCloud is a set of new features and ...
- Importing/Indexing database (MySQL or SQL Server) in Solr using Data Import Handler--转载
原文地址:https://gist.github.com/maxivak/3e3ee1fca32f3949f052 Install Solr download and install Solr fro ...
- Solr基础知识二(导入数据)
上一篇讲述了solr的安装启动过程,这一篇讲述如何导入数据到solr里. 一.准备数据 1.1 学生相关表 创建学生表.学生专业关联表.专业表.学生行业关联表.行业表.基础信息表,并创建一条小白的信息 ...
- PHP7函数大全(4553个函数)
转载来自: http://www.infocool.net/kb/PHP/201607/168683.html a 函数 说明 abs 绝对值 acos 反余弦 acosh 反双曲余弦 addcsla ...
- The Myths about Transactions (ACID) and NoSQL
There has been widespread characterization of one of the major distinctions between NoSQL and tradit ...
随机推荐
- [LeetCode&Python] Problem 371. Sum of Two Integers
Calculate the sum of two integers a and b, but you are not allowed to use the operator + and -. Exam ...
- python 加密 hashlib与hmac模块
https://www.jb51.net/article/128911.htm hashlib模块简介: hashlib模块为不同的安全哈希/安全散列(Secure Hash Algorithm)和 ...
- VS 提升代码辨识度 (工欲善其事必先利其器)新手开发必备!
VS简化编译.提高生产 本文提供全流程,中文翻译. Chinar 坚持将简单的生活方式,带给世人!(拥有更好的阅读体验 -- 高分辨率用户请根据需求调整网页缩放比例) Chinar -- 心分享.心创 ...
- Blender 画正四面体
正四面体打开“添加网格”菜单(Shift + A),然后选择“锥形”.将“顶点数”设置为3,将“半径1”保留为默认值1.000,将“半径2”设置为0.000.现在,将深度设置为 {根号2,约等于1.4 ...
- [codeforces round#475 div2 ][C Alternating Sum ]
http://codeforces.com/contest/964/problem/C 题目大意:给出一个等比序列求和并且mod 1e9+9. 题目分析:等比数列的前n项和公式通过等公比错位相减法可以 ...
- 安装排错 max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
https://blog.csdn.net/cookzrk/article/details/80179006 转载:https://my.oschina.net/u/2510243/blog/8105 ...
- 固态硬盘和机械硬盘双硬盘安装win10,提示无法找到系统
选择兼容模式,自己慢慢找,不同的主板所在的位置不同,大概是cms(兼容的意思)这个选项,选择enable就可以了
- readv与writev
[root@bogon mycode]# cat writev.c #include<stdio.h> #include<string.h> #include<unist ...
- .NET本质论 组件
模块定义 CLR程序存在模块(module)中.一个CLR模块是一个字节流,通常作为一个文件存储在本地的文件系统中或者Web服务器上 CLR模块采用Windows NT的PE/COFF可执行文件格式的 ...
- mysql中 where in 用法详解
这里分两种情况来介绍 1.in 后面是记录集,如: select * from table where uname in(select uname from user); 2.in ...