Can we Use Apache Cassandra instead of JDBC in SpringSocialShowcase - cassandra

I can run this application with no issues with my sql.
https://github.com/spring-projects/spring-social-samples/tree/master/spring-social-showcase
Can I override the UserConnectionRepository to make this application work with cassandra.
Thanks

You probably don't want to "override" it, but rather create a new repository that provides the same functionality, but instead of JDBC it can use Datastax Cassandra driver for communication with Cassandra cluster. You can then use your new repository in place of the original one. If this project uses dependency injection, it should be 1 line change.
Word of caution, this project is rather basic and contains bad practices. If you just want to get your hands dirty, it's fine, but this is definitely not a good production sample (no error handling, lack of security checks, password stored in clear text etc).

Related

Is there a simple Jmeter performance test case for Cassandra

We are creating Jmeter performance benchmarking for our Cassandra installation.
For which we have been referring to the default Cassandra plugin mentioned in the site
This plugin does not take any Cassandra server connection parameter for the "put", no much help is also present to how to use this plugin.
Some can help me with this plugin if any one knows how to configure Cassandra connection
Hence we switched to an article to test Cassandra with Groovy. (Link here)
This site calls to add multiple jar some are bundles and cannot find the exeat JAR
snappy-java-1.0.5
netty-transport-4.0.33.Final
netty-handler-4.0.33.Final
netty-common-4.0.33.Final
netty-codec-4.0.33.Final
netty-buffer-4.0.33.Final
metrics-core-3.1.2
lz4-1.2.0
HdrHistogram-2.1.4
guava-16.0.1
Can some help me with some simpler test perform on Cassandra ?
For correct performance testing of Cassandra it's better to use specialized tools, like NoSQLBench that was developed specifically for that task. Generic tools won't give you the real performance numbers. Please read NoSQLBench documentation on how to correctly test Cassandra to take into account things like compaction, repairs, etc.
Have you tried to read documentation which mentions CassandraProperties configuration element where you can define your connection server parameters:
If you want to have the full control and not only be limited to what other guys implemented you can consider following instructions from Cassandra Load Testing with Groovy article

stubbed cassandra for data storage

I need an embedded cassandra for my project and I was wondering if I can use Stubbed Cassandra for data storage. Because I need a system to simulate CQL requests and responses.
Thanks everyone.
You cant use it as a real datastore. Use real cassandra as a real cassandra datastore. check out ccm which is probably more what your looking for.
There are wrappers for it in dtests (python) and the java driver uses it for testing and has a java wrapper.
I don't really have any experience at all with SCassandra but I worked on several projects using Apache Cassandra and there are some use cases like multidatacenter infrastructure to experiment and I don't think SCassandra can do it. So if you plan to do simple tests, that's fine, But advanced use cases really need to be tested in a real cassandra distribution.
As others have mentioned, you will need the real Cassandra for data storage. However, if you want to test CQL requests/responses then you can use this library:
Cassandra-Spy
It runs an actual embedded Cassandra and also can simulate failures for inserts/selects. This helps you test your app's behaviour in failure cases. I wrote the library to address this specific use case.

Thrift, CQL3 or what?

Recently I noticed the Cassandra and DataStax are pushing CQL3 more. A new java driver even released, this one does not use Thrift at all.
And if your are not going to use "compact storage" you will not able to use Thrift with your application. Thus, I believe that Thrift is fading out from Cassandra.
My question is, for a new application should I go head and use CQL3? However, I still prefer thrift because I want to know what's going on underneath and on the other hand I do not want to be using something that is fading out and becoming a legacy. What do you recommend?
My company recently went through the same thought process and ended up using CQL3 over thrift.
Although there is a slight lack of transparency with the additional layer of abstraction going on with CQL3, the ease and familiarity of writing SQL style statements makes the code much more readable and intuitive in my opinion. Plus we found the cqlsh interface far more user friendly than cassandra-cli for debugging and general db maintenance (the auto-complete is fab in cqlsh!).
Once you understand the underlying data structure and how CQL3 represents that data, the extra layer of abstraction pales into insignificance, really.
Datastax are encouraging developers to use cql3 for newer applications. From the Thrift to CQL3 Guide:
…we believe that CQL3 is a simpler and overall better API for Cassandra than the thrift API is. Therefore, new projects/applications are encouraged to use CQL3 (though remember that CQL3 is not final yet, and so this statement will only be fully valid with Cassandra 1.2). But the thrift API is not going anywhere.
Thrift won't be getting newer features (unless they are requested a lot) so it's safe to say that CQL3 is the better choice for new apps (of course there are exceptions… if you need low-level you need thrift). My only pain is that datastax's driver does not yet support SSL but that is in the pipeline and will hopefully be a committed feature soon.

How to use devise with Cassandra

I'm using Cassandra as the database and want to use Devise
Does Devise support Cassandra as the database? I looked around but did not find any information related to Devise-Cassandra on the wiki or anywhere else.
Is there third party plugins supporting it or other gem for authentication as devise?
Thank you
No, I have never heard of such thing.
Actually I suggest you keep your users in a more traditional database and use cassandra only for the most intensive I/O data.
Cassandra wasn't made to substitute other databases nor to be user with ORM (that's actually written in its official webpage)

Hector for Cassandra

I can't set up Hector for Cassandra. I've looked through the documentation and the Cassandra wiki. The problem with these docs is that a lot of the information there is outdated, or minimalistic (or I'm lacking knowledge). Anyway, I'm wondering if anyone can provide some rough simplistic guide as to how to go about installing it.
I'm aiming to build a JSP page that can use the Cassandra database.
What I've done so far:
I've downloaded Hector 1.0-2 and Cassandra 1.0.7.
I've set up Cassandra and checked it works (used CLI to create new columns using keys)
Tried unpacking the me.prettyprint.cassandra into the Java project directory but still nothing.
I'm also not sure where to get the thrift API (or how to install it)? And, if i need it at all?
Any help would be appreciated.
As I remember, it was very easy to install Cassandra, and get Hector to work for a basic insert, retrieve example. It's like
Install Cassandra
Create keyspace, and column families from Cassandra CLI.
Create a plain Java Maven project, and add Hector, and Thrift dependencies to it. (Maven is not necessary, I just meant a simple hello-world project here.)
Write insert code, then check into Cassandra using CLI.
Write retrieve query, then see if matches, and slices properly.
But that was Cassandra 0.6.0. Not sure what so hard.
Please look into this tutorial, and you can also see this simple source code for insertion.
If you land into some trouble come with specific problem, it will be much easier that way.
Hope this helps.

Resources