NoSql数据库之Cassandra客户端比较

十点数据 1年前 ⋅ 2642 阅读

目前市面上Cassandra的客户端主要有以下三种:

1 [Thrift](http://www.blog2019.net/tag/Thrift?tagId=167) [Java](http://www.blog2019.net/tag/Java?tagId=168) API
2 hector
3 [Astyanax](http://www.blog2019.net/tag/Astyanax?tagId=166)
4 Pelops

Thrift优/缺点

优点:简单高效 缺点:功能简单,无法提供连接池,错误处理等功能,不适合直接在生产环境使用。

hector优/缺点

优点

1 提供连接池。
2 提供错误处理:当操作失败的时候,Hector会根据系统信息(token map)自动连接另一个Cassandra Service。
3 编程接口容易使用。
4 支持JMX。

缺点

1 不支持多线程的环境。
2 keyspace封装过多(数据校验和数据重新封装),如果进行大量的数据操作,这里的消耗需要考虑。
3 错误处理不够人性化:如果所有的Cassandra Service都非常繁忙,那么经过多次操作失败后,最终的结果失败。

总结

Hector已经是一个基本足够使用的Java客户端了,但是还是缺乏一些相关的功能,比如:

1 线程安全。
2 支持自动的多线程查询和插入,提高操作效率。
3 人性化的错误处理机制。
4 避免过多的封装。

Astyanax优/缺点

特性:

高级别,简单的面向对象的Cassandra接口。
在客户端实现故障转移
抽象的连接池。 Implementation of a round robin connection pool.
Monitoring abstraction to get event notification from the connection pool.
Complete encapsulation of the underlying Thrift API and structs.
自动重试挡掉的主机。	
自动发现集群中的其他主机。
Suspension of hosts for a short period of time after several timeouts.
Annotations to simplify use of composite columns.

项目主页:http://www.open-open.com/lib/view/home/1352873101558

全部评论: 0

    我有话说: