Cassandra 客户端 Java API [英] Cassandra Client Java API's

查看:29
本文介绍了Cassandra 客户端 Java API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近开始使用 Cassandra 数据库.现在我正在评估我们应该继续使用哪个 Cassandra 客户端.

I have recently started working with Cassandra Database. Now I am in the process of evaluating which Cassandra client we should go forward with.

我在 stackoverflow 上看到过各种关于 Cassandra 使用哪个客户端的帖子,但没有一个给出非常明确的答案.

I have seen various post on stackoverflow about which client to use for Cassandra but none has very definitive answer.

我的团队要求我对此进行一些研究,并针对 Java 中的每个 Cassandra Client API 提出某些 优缺点.

My team has asked me to do some research on this and come up with certain pros and cons for each Cassandra Client API’s in Java.

正如我提到的,我最近参与了 Cassandra,所以不太了解为什么某些人选择 Pelops 客户端 以及为什么某些人选择 Astyanax 和其他一些客户端.

As I mentioned, I recently got involved with Cassandra so not have that much idea why certain people choose Pelops client and why certain people go with Astyanax and some other clients.

我了解每个 Cassandra 客户端的简要情况,我的意思是我能够完成这项工作并开始读取和写入 Cassandra 数据库.

I know brief things about each of the Cassandra clients, by which I mean I am able to make that work and start reading and writing to Cassandra database.

以下是我目前掌握的信息.

Below is the information I have so far.

CASSANDRA API

  • Hector(生产就绪)
    最稳定的 Java API,随时可用.

  • Hector (Production-Ready)
    The most stable of the Java APIs, ready for prime-time.

Astyanax(后起之秀)
来自 Netflix 的干净的 Java API.它不像 Hector 那样被广泛使用,但它是可靠的.

Astyanax (The Up and Comer)
A clean Java API from Netflix. It isn't as widely used as Hector, but it is solid.

昆德拉(NoSQL ORM)
JPA 兼容,当您想通过对象与 Cassandra 交互时,这很方便.
这在某种程度上限制了您,因为您将无法拥有动态数量的列/名称等.但它确实允许您移植 ORM,或集中存储到 Cassandra 上进行更传统的用途.

Kundera (The NoSQL ORM)
JPA compliant, this is handy when you want to interact with Cassandra via objects.
This constrains you somewhat in that you won't be able to have a dynamic number of columns/names, etc. But it does allow you to port over ORMs, or centralize storage onto Cassandra for more traditional uses.

Pelops
我只是简单地使用过 Pelops.这是一个直接的 API,但似乎没有有它背后的动力.

Pelops
I've only used Pelops briefly. It was a straight forward API, but didn't seem to have the momentum behind it.

PlayORM(没有约束的 ORM?)
我刚听说这件事.看起来它正在试图解决阻抗通过引入 JQL 在传统的基于 JPA 的 ORM 和 NoSQL 之间不匹配.它看起来很有希望.

PlayORM (ORM without the constraints?)
I just heard about this. It looks like it is trying to solve the impedance mismatch between traditional JPA-based ORMs and NoSQL by introducing JQL. It looks promising.

节俭(避开我!)
这是低级"API.

Thrift (Avoid Me!)
This is the "low-level" API.

以下是我们决定Cassandra Client-

  • 首要任务是:低延迟开销、异步 API 以及生产环境的可靠性/稳定性.
    (例如,可以在封装客户端的 DAL 中使用更加用户友好的 API).
  • 连接池和分区感知是其他一些不错的功能.
  • 能够检测添加的任何新节点.
  • 良好的支持(如下面的院长所指出的)

谁能提供一些关于这个的想法?以及每个 Cassandra Client 的任何优点和缺点以及哪个客户端可以满足我的要求也会有很大帮助.

Can anyone provide some thoughts on this? And also any pros and cons for each Cassandra Client and also which client can fulfill my requirements will be of great help as well.

我相信,我将主要围绕 Astyanax 客户端或使用二进制协议的新 Datastax 客户端 我猜基于我目前的研究.但是没有某些信息来支持我的研究并将其呈现给我的团队.

I believe, mainly I will be revolving around Astyanax client or New Datastax client that uses Binary protocol I guess basis on my research so far. But don't have certain information to back my research and present it to my team.

Astyanax 客户端和 New Datastax 客户端(使用新的二进制协议)之间的任何比较都会有很大帮助.

Any comparison between Astyanax client and New Datastax client(which uses new Binary protocol) will be of great help.

这将对我的研究有很大帮助,并且会从过去使用过不同客户的不同人那里获得很多相关知识.

It will be of great help to me in my research and will get lot of knowledge on this from different people who have used different clients in the past.

推荐答案

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.

这篇关于Cassandra 客户端 Java API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆