Apache Cassandra Horizontal Scalability for Java Applications [Book]
Get to know how to use Cassandra with Java, the applicability with Cassandra, and several Java Frameworks such as Hibernate, Spring, Quarkus, Jakarta EE, and so on.
Join the DZone community and get the full member experience.Join For Free
The business world grows exponentially with several opportunities and companies competing with each other. The dispute between customers is something that is no longer defined by the company's location, but by its applications' response time. Several studies reveal that millisecond improvements are enough to acquire new customers and retain existing ones, in addition to overcoming the competition.
In this battle for milliseconds, several paradigms and frameworks have been created. All this improvement, however, would be useless if the persistence of information was still the bottleneck.
With the need for better performance, NoSQL databases emerged to facilitate performance and information distribution. Along with this concept, Apache Cassandra was born, the elastic NoSQL database, fault-tolerant with a high level of performance, achieving success in the largest companies in the world such as Netflix, GitHub, and eBay, among others. Cassandra is a non-relational database developed by Facebook, and today is an open-source column family type NoSQL database within the Apache Foundation. In general, the objective of this book is to talk about Cassandra, its concepts, and its applicability to Java. To cover all of the concepts, the book was sectioned into a total of nine chapters.
The scope of the first chapter is the introduction to non-relational databases. The chapter addresses the challenges of distributed databases, their limitations with the CAP theorem, which is NoSQL and its types, as well as the comparison between NoSQL and the already consolidated relational database.
In the second chapter, we will cover Cassandra's concepts, such as its hierarchy, reading, and writing, its functioning in the node, and its orchestration within a cluster. We will see different ways of installing Cassandra - manual installation, Docker, and clustering with docker-compose.
Using queries is very common within a database. In the relational world, the developer is familiar with SQL. Cassandra has its own query language: Cassandra Query Language or CQL, and note that, one of its biggest differentials is the similarity with SQL. Learning how to create keyspace, column family, perform CRUD operations (creation, recovery, update and delete data) that the developer loves so much are topics in this chapter.
There are several similarities between Cassandra's communication language, CQL, and SQL. However, the database's similarities end there. It is worth remembering that conceptually, taking into account the CAP theorem, the relational database and Cassandra are in different aspects. Thus, performing the modeling of Cassandra in the same way that it takes place within the relational database will have a high-performance impact, not to mention that you'd be trying to use an airplane as if it were a car. The topics of this session are the explanation and tips to perform the modeling in Cassandra and some simple principles for daily modeling.
After all of Cassandra's communication concepts and modeling tips, the next step is the integration with Java. Within this communication between Java and Cassandra, the first point to be covered is how to implement it with the DataStax Driver whose API is similar to the JDBC driver. An important point within the DataStax Driver is that once the developer is familiar with CQL, all communication takes place in a very fluid way. Businesses are generally very object-oriented, the content covers the impacts of Mappers, frameworks whose objective is to carry out the mapping between Cassandra and the objects of a business entity, positively as productivity and negatively with possible performance problems. Among these mappers, we will use DataStax Mapper, Spring Data Cassandra, Hibernate OGM Cassandra, and Eclipse JNoSQL, and to facilitate the comparison between them, the same example will be used, which is based on a solution for a library.
Opinions expressed by DZone contributors are their own.