egmkang 服务端开发工程师

cassandra性能测试

2016-10-10

昨天在内网弄了一个cassandra集群, 6个节点, 都是虚拟机, 宿主机CPU是Xeon E5606.

机器配置
8核16G
4核4G
4核4G
2核3G
4核4G
4核8G

磁盘有3块, 所以很多虚拟机都在共享磁盘, 所以这个测试结果, 应该是比较差的结果

cassandra都是默认配置, 只是设置了一下IP地址之类的, 8核16G那个机器是种子节点

./cassandra-stress write n=1000000 -rate threads=64

Op rate                   :   15,127 op/s  [WRITE: 15,127 op/s]
Partition rate            :   15,127 pk/s  [WRITE: 15,127 pk/s]
Row rate                  :   15,127 row/s [WRITE: 15,127 row/s]
Latency mean              :    4.2 ms [WRITE: 4.2 ms]
Latency median            :    2.6 ms [WRITE: 2.6 ms]
Latency 95th percentile   :    9.9 ms [WRITE: 9.9 ms]
Latency 99th percentile   :   33.2 ms [WRITE: 33.2 ms]
Latency 99.9th percentile :  112.3 ms [WRITE: 112.3 ms]
Latency max               :  472.6 ms [WRITE: 472.6 ms]
Total partitions          :  1,000,000 [WRITE: 1,000,000]
Total errors              :          0 [WRITE: 0]
Total GC count            : 0
Total GC memory           : 0.000 KiB
Total GC time             :    0.0 seconds
Avg GC time               :    NaN ms
StdDev GC time            :    0.0 ms
Total operation time      : 00:01:06

各个节点的负载也不算高, CPU占有率50%左右

只不过有一个问题, 默认bench的keyspace设置的是只有1个副本, 真实很少会使用这种配置, 所以我自己写了一个C#的test, 测试一下有3个副本的是, 情况是什么样子.

开一个线程阻塞的去update, 10W次

Latency mean              :    1.6 ms
Latency median            :    1.1 ms
Latency 95th percentile   :    1.5 ms
Latency 99th percentile   :   15.9 ms
Latency 99.9th percentile :  114.0 ms
Latency max               :  245.9 ms

开一个线程去select, 1W次:

Latency mean              :    2.0 ms
Latency median            :    1.2 ms
Latency 95th percentile   :    2.3 ms
Latency 99th percentile   :   11.5 ms
Latency 99.9th percentile :  224.8 ms
Latency max               :  224.8 ms

性能感觉还可以接受, 毕竟如果异步的去update/select, 可以同时干好几件事情, 不用等待


Comments