且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Cassandra 客户端 Java API

更新时间:2022-06-24 21:55:33

Thrift 越来越像一个遗留 API:

Thrift is becoming more of a legacy API:

首先,您应该意识到 Thrift API 不会获得新功能;它用于向后兼容,不推荐用于新项目.
- 保罗

First, you should be aware that the Thrift API is not going to be getting new features ; it's there for backwards compatibility, and not recommended for new projects.
- the paul

所以我会避免使用基于 Thrift 的 API(保留 Thrift 只是为了向后兼容).

So I'd avoid Thrift based APIs (thrift is only kept for backwards compatibility).

也就是说,如果您确实需要使用基于节俭的 API,我会选择 Astyanax.Astyanax 非常易于使用(与其他 thrift API 相比,但我个人的经验是 Datastax 的驱动程序更简单).

In saying that if you do need to use a thrift based API I'd go for Astyanax. Astyanax is very easy to use (compared to other thrift APIs but my personal experience is that Datastax's driver is even easier).

所以你应该看看 Datastax 的 API(和 GitHub 存储库)?我不确定是否有任何编译版本的 API 可供下载,但您可以使用 Maven 轻松构建它.此外,如果您查看 GitHub 存储库的提交日志,它会进行非常频繁的更新.

So you should have a look at Datastax's API (and GitHub repo)? I'm not sure if there any compiled versions of the API for download but you can easily build it with Maven. Also if you take a look at the GitHub repo's commit logs it undergoes very frequent updates.

该驱动程序仅适用于 CQL3 并且是异步的,但请注意 Cassandra 1.2 是最早支持的版本.

The driver works exclusively with CQL3 and is asynchronous but be warned that Cassandra 1.2 is the earliest supported version.

性能
Astyanax 是基于节俭的,而 Datastax 的驱动器是二进制协议.这是我可以在 thrift 和 CQL 之间找到的最新基准(注意这些是肯定过时了).但公平地说,这些基准测试中显示的微小性能差异很少有影响.

Performance
Astyanax is thrift based and Datastax's drive is the binary protocol. Here are the latest benchmarks I could find between thrift and CQL (note these are definitely out of date). But in fairness the small difference in performance shown in these benchmarks will rarely matter.

异步支持
Datastax 的asynch 支持绝对优于 Astyanax(Netflix 尝试实施但决定不这样做).

文档
我真的无法反对 Netflix 的 wiki.该文档非常好,并且更新得相当频繁.他们的 wiki 包含代码示例,如果您需要查看工作中的代码,可以在源代码中找到测试.我努力寻找 Datastax 驱动程序的任何文档,但 GitHub 存储库中提供了测试,因此这是一个起点.

Documentation
I cant really argue against Netflix's wiki. The documentation is excellent and its updated fairly frequently. Their wiki includes code examples, and you can find tests in the source code if you need to see the code at work. I struggled to find any documentation of the Datastax driver however test are provided in the GitHub repository so that is a starting point.

另请参阅这个答案(好吧..不是我的一个)它研究了 Thrift 和 CQL 的一些优点/缺点.

Also have a look at this answer (well.. not my one anyway) It looks into some advantages/disadvantages of Thrift and CQL.