The benefits of using cql over thrift

Are there any distinct advantages to using cql for frugality or is it just a case when developers are too accustomed to SQL? I want to switch from a lean query to cql, the only problem is I am not sure about the disadvantages of this. What are they?

+15
cassandra cql thrift
Mar 29 '13 at 10:15
source share
2 answers

Inquiries
In CQL, you can query cassandra and get the data in several rows (using the JDBC driver):

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

In the lean API, this is a bit more complicated (Astyanax example):

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

Performance
Based on Acunu benchmarks, 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 to this performance advantage in order to have significant benefits.




Some excellent search articles:

EDIT

The above tests are outdated, paul provided newer standards in the prepared reports .

+16
Mar 29 '13 at 10:30
source share

Luben's answer is good, but I believe that he can be misinformed on several points. First, you should be aware that the Thrift API will not receive new functions; it is there for backward compatibility and is not recommended for new projects. There are already some features that cannot be used through the Thrift interface.

Another factor is that the quoted tests from Acunu are misleading; they do not measure CQL performance using prepared statements. See, for example, the graphs at https://issues.apache.org/jira/browse/CASSANDRA-3634 (probably the same dataset on which the Acunu record is based, since Eric Evans wrote both). There have also been some improvements in CQL parsing and performance last year. You are unlikely to notice any real speed difference between CQL 3 and Thrift.

Finally, I do not think that I even agree that Thrift is more flexible. The CQL 3 datamodel allows using the same data structures as Thrift for almost all applications that are not antipatterns; it just allows you to think about the model in a more organized way. For example, Luben mentioned rows with a different number of columns. CQL 3 table can still take advantage of this feature: there is a difference between the “storage core rows” (which is the low-level storage of Cassandra and what Thrift uses directly) and the “CQL strings” (which you see through the Thrift interface). CQL just does the extra work necessary to visualize large rows of the storage engine in the form of structured tables.

It's a little hard to explain with the quick answer of SO, but see this post for a gentle explanation.

+22
Mar 29 '13 at 17:19
source share



All Articles