本文介绍了使用cql over thrift的优点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用cql超过thrift有什么明显的优势或者只是开发人员过于习惯于SQL的情况?我想从thrift查询切换到cql,唯一的问题是我不知道这样做的缺点。他们是什么?

Are there any distinct advantages for using cql over thrift or is it simply a case of developers being too used to SQL? I'm wanting to switch from thrift querying to cql, the only problem is I'm not sure about the downsides of doing so. What are they?

推荐答案

查询 cassandra和获取数据在几行(使用JDBC驱动程序):

Querying
In CQL you can query cassandra and get data in a couple of lines (using JDBC driver):

String query = "SELECT * FROM message;";
PreparedStatement statement = con.prepareStatement(query);

在基于thrift的API中,它更复杂一些(例如Astyanax):

While in thrift based API's it's a bit more complicated (example with Astyanax):

OperationResult<ColumnList<String>> result =
     keyspace.prepareQuery(mail/*specify columnfamily structure*/)
             .getKey("lyuben@1363115059").execute();
ColumnList<String> columns = result.getResult();

效果

基于由Acunu,Thrift(RPC)稍微领先的CQL在查询性能方面,但是你需要在高吞吐量是这种性能优势的关键,以获得显着的效益。

Performance
Based on the benchmarks carried out by Acunu, Thrift (RPC) is slightly ahead of CQL when it comes to query performance, but you need to be in a situation where high throughput is key for this performance advantage to have a significant benefit.

一些优秀的文章可以查找:

Some excellent articles to lookup are:




  • A thrift to CQL3 upgrade guide.
  • CQL vs RPC - Acunu benchmarks
  • CQL3 for cassandra experts

EDIT

上述基准已过时,paul提供。

The above benchmarks are outdated, the paul provided newer benchmarks on prepared statements.

这篇关于使用cql over thrift的优点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-11 04:40