Cassandra Issue with Tombstone
1. Cassandra is quicker than postgre and have lower change to lose data. Cassandra doesn't have foreign keys, locking mechanism and etcs, so that it's quicker on writes.
2. Everything in cassandra is a write. Insert/update/delete is also write.
3. Setting a column to null/ deleting a column will create a tomestone; Deleting a row/primary key/partitio will create a single row tomestone
4. Could adjust tombstone_warn_threshold and tombstone_failure_threshold in cassandra.yaml.
5. Could adjust gc_grace_seconds when creating table
6. Hitting tombstone limit only happens per query.
Related Attributes
Delete will create tombstones
tombstone_warn_threshold: 1000 (default), could be found in cassandra.yaml
tombstone_failure_threshold: 100000 (default), could be found in cassandra.yaml
tombstone_compaction_interval: table attribute
min_compaction_threshold: table attribute #Compaction will only be eligible after min_compaction_threshold SSTables exist, by default it’s 4.
gc_grace_seconds: table attribute
snapshot_before_compaction: false
Check table attributes here http://docs.datastax.com/en/cassandra/2.1/cassandra/reference/referenceTableAttributes.html
Could consider using DateTieredCompactionStrategy instead of the default SizeTieredCompactionStrategy.
Cassandra MBean
Use Jconsole to remotely connect to:
hostname:7199
e.g. localhost:7199
Check/change the TombstoneFailureThreshold attribute inside StorageService MBean.
Force a flush and compaction
sudo nodetool -h localhost -p 7199 -u OC_APP_RAINBOWDBA -pw a3c224d4b89192d2ea3ea943dd7e9648 flush rainbowdba undeliveredmessage
sudo nodetool -h localhost -p 7199 -u OC_APP_RAINBOWDBA -pw a3c224d4b89192d2ea3ea943dd7e9648 compact rainbowdba undeliveredmessage
Deleted rows will only disappear when gc_grace_seconds time passed and a flush and compaction has been forced
Truncating Table
Truncating a table is an immediate operation and won’t leave any tomestones.
Don’t insert Null into columns
Inserting a null value to the column will leave a cell tomestone. Deleting a partition/row will also create a single row tombstone.
Deleting a partition will create a partition tomestone and override the existing cell tomestones. This only happens in memory table not on the disk. Not sure whether creating a partition tomestone will cause a compaction of the cell tomestones on disk.
Using TTL
insert into undeliveredmessage("id", "message","type") values('1','message','RAVEN') using ttl 5;
This query will result in 3 tomestone cells and one row tombstone.
Cassandra partition size limitation
In Cassandra, the maximum number of cells (rows x columns) in a single partition is 2 billion.
Additionally, a single column value may not be larger than 2GB. Partitions greater than 100Mb can cause significant pressure on the heap.
Performance Test
Test script TestCassandraPerformance.java could be found in
Cassandra version: 2.2.3, cqlsh 5.0.1
1. TombstoneFailureThreshold = 500
Seems persist 102000 rows and then delete them won’t hit the limit of the tomestone.
2. TombstoneFailureThreshold = 1
insert into undeliveredmessage("id","message","sent","type") values('3', 'message3', True, null);
and then select * from undeliveredmessage is fine
2. TombstoneFailureThreshold = 1
insert into undeliveredmessage("id","message","sent","type") values('3', 'message3', null, null);
and then select * from undeliveredmessage will hit the tomestone limit
|
deleted rows number |
existing rows number |
locally recovery time |
vector 2 recovery time |
|
150_000 * 9 |
Operation Timed Out |
Operation Timed Out |
|
|
150_000 * 5 |
9_072 ms |
10_152 ms |
|
|
150_000 * 3 |
5_679 ms |
7_957 ms |
|
|
150_000 * 2 |
3_025 ms |
5_218 ms |
|
|
150_000 |
1_326 ms |
1_879 ms |
|
|
150_000 |
158 ms |
333 ms |
|
|
150_000 *2 |
562 ms |
1_963 ms |
|
|
150_000 *3 |
2_223 ms |
3_833 ms |
|
|
150_000 *5 |
3_476 ms |
9_726 ms |
|
|
150_000 *10 |
Operation Timed Out |
Operation Timed Out |
|
|
150_000 |
150_000 |
1_321 ms |
3_735 ms |
|
150_000 *2 |
150_000 |
1_893 ms |
4_939 ms |
Note that we will hit timeout issue when having 150_000 *10 deleted rows in the table.
Hitting tombstone limit
For Dash you should see
com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: localhost/127.0.0.1:9042 (com.datastax.driver.core.exceptions.ReadTimeoutException: Cassandra timeout during read query at consistency ONE (1 responses were required but only 0 replica responded)))
at com.datastax.driver.core.ControlConnection.reconnectInternal(ControlConnection.java:223)
For query in command line, you should see something like:
Traceback (most recent call last):
File "/usr/bin/cqlsh.py", line 1172, in perform_simple_statement
rows = future.result(self.session.default_timeout)
File "/usr/share/cassandra/lib/cassandra-driver-internal-only-2.7.2.zip/cassandra-driver-2.7.2/cassandra/cluster.py", line 3347, in result
raise self._final_exception
ReadFailure: code=1300 [Replica(s) failed to execute read] message="Operation failed - received 0 responses and 1 failures" info={'failures': 1, 'received_responses': 0, 'required_responses': 1, 'consistency': 'ONE'}
Cassandra Issue with Tombstone的更多相关文章
- Cassandra issue - "The clustering keys ordering is wrong for @EmbeddedId"
在Java连接Cassandra的情况下, 当使用组合主键时, 默认第一个是Partition Key, 后续的均为Clustering Key. 如果有多个Clustering Key, 在Java ...
- akka-typed(10) - event-sourcing, CQRS实战
在前面的的讨论里已经介绍了CQRS读写分离模式的一些原理和在akka-typed应用中的实现方式.通过一段时间akka-typed的具体使用对一些经典akka应用的迁移升级,感觉最深的是EvenSou ...
- Cassandra简介
在前面的一篇文章<图形数据库Neo4J简介>中,我们介绍了一种非常流行的图形数据库Neo4J的使用方法.而在本文中,我们将对另外一种类型的NoSQL数据库——Cassandra进行简单地介 ...
- Cassandra 计数器counter类型和它的限制
文档基础 Cassandra 2.* CQL3.1 翻译多数来自这个文档 更新于2015年9月7日,最后有参考资料 作为Cassandra的一种类型之一,Counter类型算是限制最多的一个.Coun ...
- 闲聊cassandra
原创,转载请注明出处 今天聊聊cassandra,里面用了不少分布式系统设计的经典算法比如consistent hashing, bloom filter, merkle tree, sstable, ...
- 开源软件:NoSql数据库 - 图数据库 Cassandra
转载原文:http://www.cnblogs.com/loveis715/p/5299495.html Cassandra简介 在前面的一篇文章<图形数据库Neo4J简介>中,我们介绍了 ...
- Cassandra User 问题汇总(1)------------repair
Cassandra Repair 问题 问1: 文档建议每周或者每月跑一次full repair.那么如果我是使用partition rangerepair,是否还有必要在cluster的每个节点上定 ...
- 从Stage角度看cassandra write
声明 文章发布于CSDN cassandra concurrent 具体实现 cassandra并发技术文中介绍了java的concurrent实现,这里介绍cassandra如何基于java实现ca ...
- Cassandra 原理介绍
Cassandra最初源自Facebook,结合了Google BigTable面向列的特性和[Amazon Dynamo](http://en.wikipedia.org/wiki/Dynamo(s ...
随机推荐
- 老李分享:Uber究竟是用什么开发语言? 1
老李分享:Uber究竟是用什么开发语言? poptest是国内唯一一家培养测试开发工程师的培训机构,以学员能胜任自动化测试,性能测试,测试工具开发等工作为目标.如果对课程感兴趣,请大家咨询qq:9 ...
- 老李教你性能测试监控工具nmon
老李教你性能测试监控工具nmon loadrunner的某些性能监控器不够强大,这就需要我们利用更好的工具进行监控,在项目中我们会用nmon工具作为辅助性能监控的工具,帮助我们进行性能分析,pop ...
- 性能测试分享:MYSQL死锁
poptest是国内唯一一家培养测试开发工程师的培训机构,以学员能胜任自动化测试,性能测试,测试工具开发等工作为目标.如果对课程感兴趣,请大家咨询qq:908821478,咨询电话010-845052 ...
- WPF 截屏软件开发
最近由于工程需要开始研发基于Windows的自动录屏软件,很多细节很多功能需要处理,毕竟一个完美的录屏软件不是你随随便便就可以写出来的.首先参考了大部分的录屏软件,在研发的过程中遇到了很多的问题:比如 ...
- 看Lucene源码必须知道的基本概念
终于有时间总结点Lucene,虽然是大周末的,已经感觉是对自己的奖励,毕竟只是喜欢,现在的工作中用不到的.自己看源码比较快,看英文原著的技术书也很快.都和语言有很大关系.虽然咱的技术不敢说是部门第一的 ...
- ASP.NET自定义模块
要创建自定义模块,类需要实现IHttpModule接口.这个接口定义了Init和Dispose方法. Init方法在启动Web应用程序时调用,其参数的类型是HttpContext,可以添加应用程序处理 ...
- Windows安装mysql-python提示:error: Microsoft Visual C++ 9.0 is required
Windows安装mysql-python提示:error: Microsoft Visual C++ 9.0 is required,Get it from http://aka.ms/vcpyth ...
- IntelliJ IDEA应用[一]下载与安装
一.IntelliJ IDEA 12.1.6的下载 IntelliJ IDEA的官方下载网站:http://www.jetbrains.com/idea/download/
- canvas画图
这个元素负责在页面中设定一个区域,然后就可以通过JS动态的在这个区域中绘制图形. <canvas>由几组API构成. <canvas>还建议一个名为WebGL的3D上下文 (1 ...
- 多个git账号的SSH配置
一般使用git都只需要维持一个默认的git账户就可以打天下了. 但如果自己确实需要多个git账号的需求的话,就有必要配置多个ssh key了. 首先为生成多个ssh key ssh-keygen -t ...