IT技术博客大学习 共学习 共进步
全部 移动开发 后端 数据库 AI 算法 安全 DevOps 前端 设计 开发者

转载:cassandra读写性能原理分析

Data & Architecture DBA 2010-04-01 08:54:38 累计浏览 4,788 次
本机暂存

1.  关于cassandra的读性能分析的一篇文章:

     Mike Perham  continues his series now explaining: “reads and […] why they are slow”.

So what happens with a Cassandra read?

  • a client makes a read request to a random node
  • the node acts as a proxy determining the nodes having copies of data
  • the node request the corresponding data from each node
  • the client can select the strength of the read consistency:
    • single read => the request returns once it gets the first response, but data can be stale
    • quorum read => the request returns only after the majority responded with the same value

Mark mentions a couple of corner cases related to this behavior that is more complicated.

  • the node also performs read repair of any inconsistent response
  • each node reading data uses either Memtable (in-memory) or SSTables (disk)

Mike and Jonathan provide a very detailed explanation of the read performance:

Mike: To scan the SSTable, Cassandra uses a row-level column index and bloom filter to find the necessary blocks on disk, deserializes them and determines the actual data to return. There’s a lot of disk IO here which ultimately makes the read latency higher than a similar DBMS.

Jonathan: The reason uncached reads are slower in Cassandra is not because the SSTable is inherently io-intensive (it’s actually better than b-tree based storage on a 1:1 basis) but because in the average case you’ll have to merge row fragments from 2-4 SSTables to complete the request, since SSTables are not update-in-place.

It is also important to note that Cassandra employs row caching that addresses reads latency.

2.  关于cassandra的写性能分析的一篇文章:

An interesting explanation of how Cassandra write ops are happening:

  • client submits its write request to a single, random Cassandra node
  • the node behavior is similar to a proxy writing data to the cluster
  • writes are replicated to N nodes according to the replication placement strategy (the details of RackAwareStrategy are quite interesting)
  • each of the N nodes performs 2 actions when receiving a write (in the form of RowMutation):
    • append the mutation to the commit log for transactional purposes
    • update an in-memory Memtable structure with the change

There are also a couple of asynchronous operations:

  • Memtable is written to disk in a structure called SSTable
  • SSTables corresponding to a column family are merged into a raw ColumnFamily datafile.

参考文档:

 http://nosql.mypopescu.com/post/474623402/cassandra-reads-performance-explained

 http://nosql.mypopescu.com/post/454521259/cassandra-write-operation-performance-explained 

同分类推荐文章

  1. 使用deepseek进行Oracle恢复,引起重大故障 (2026-06-22 10:56:00)
  2. 接手一个只差临门一脚的数据库恢复 (2026-06-18 00:13:09)
  3. 我做了一个 AI 版的 StarRocks 升级风险扫描工具,直接帮我定位到一个风险 (2026-06-15 01:00:00)

查看更多 数据库 文章 →

建议继续学习

  1. 由浅入深探究mysql索引结构原理、性能分析与优化 (累计阅读 16,522)
  2. Linux如何统计进程的CPU利用率 (累计阅读 16,307)
  3. 如何查找消耗资源较大的SQL (累计阅读 15,210)
  4. hbase介绍 (累计阅读 12,367)
  5. Linux Used内存到底哪里去了? (累计阅读 11,866)
  6. HBase技术介绍 (累计阅读 8,075)
  7. SQL vs NoSQL:数据库并发写入性能比拼 (累计阅读 8,002)
  8. WEB性能测试工具推荐 (累计阅读 7,064)
  9. Linux下CPU的利用率 (累计阅读 6,652)
  10. MySQL vs NoSQL 效率与成本之争 (累计阅读 5,157)