Reader small image

You're reading from  Mastering Apache Cassandra 3.x - Third Edition

Product typeBook
Published inOct 2018
Reading LevelIntermediate
PublisherPackt
ISBN-139781789131499
Edition3rd Edition
Languages
Right arrow
Authors (3):
Aaron Ploetz
Aaron Ploetz
author image
Aaron Ploetz

Aaron Ploetz is the NoSQL Engineering Lead for Target, where his DevOps team supports Cassandra, MongoDB, and Neo4j. He has been named a DataStax MVP for Apache Cassandra three times and has presented at multiple events, including the DataStax Summit and Data Day Texas. Aaron earned a BS in Management/Computer Systems from the University of Wisconsin-Whitewater, and an MS in Software Engineering from Regis University. He and his wife, Coriene, live with their three children in the Twin Cities area.
Read more about Aaron Ploetz

Tejaswi Malepati
Tejaswi Malepati
author image
Tejaswi Malepati

Tejaswi Malepati is the Cassandra Tech Lead for Target. He has been instrumental in designing and building custom Cassandra integrations, including a web-based SQL interface and data validation frameworks between Oracle and Cassandra. Tejaswi earned a master's degree in computer science from the University of New Mexico, and a bachelor's degree in electronics and communication from Jawaharlal Nehru Technological University in India. He is passionate about identifying and analyzing data patterns in datasets using R, Python, Spark, Cassandra, and MySQL.
Read more about Tejaswi Malepati

Nishant Neeraj
Nishant Neeraj
author image
Nishant Neeraj

Nishant Neeraj is an independent software developer with experience in developing and planning out architectures for massively scalable data storage and data processing systems. Over the years, he has helped to design and implement a wide variety of products and systems for companies, ranging from small start-ups to large multinational companies. Currently, he helps drive WealthEngine's core product to the next level by leveraging a variety of big data technologies.
Read more about Nishant Neeraj

View More author details
Right arrow

Application Development

In this chapter, we will discuss the development of applications backed by Apache Cassandra. This subject is one of the most misunderstood areas of Cassandra. Too often, developers assume that their years of developing with relational databases have prepared them for working with a distributed database such as Apache Cassandra. Unfortunately, their familiar, relational foundations lead them down the wrong path.

In this chapter, we will discuss the following topics:

  • Common mistakes made at the application and data model levels
  • Driver selection
  • Appropriate connection properties
  • Handling simple and complex result sets in Java
  • Loading data without overwhelming your nodes

By the end of this chapter, you will understand how to build Java applications to work with Apache Cassandra. These example applications will start small and simple, and grow in complexity...

Getting started

The first steps to building an application for use with Apache Cassandra are both important to get right, and easy to get wrong. Here we will cover some fundamental questions about whether or not Cassandra is even the correct data store for the application in question.

But first, let's start with an overview of what the wrong path looks like.

The path to failure

As most developers are used to working with relational databases, the typical path to failure starts with a data model that closely resembles one found in a RDBMS. A loading job is then written, which only succeeds in crashing their nodes every couple of hours.

Finally, once the data is there, they build their application around a RDBMS framework...

Building a Java application

In this section, we will build a Java application to interact with our Apache Cassandra cluster. We will start with some simple examples, and build our way up to something more complex.

Finally, we will cover writing a job to load data, and discuss adjustments to allow it to work at a large scale.

Driver dependency configuration with Apache Maven

Inside our integrated developer environment (IDE), we will create a new Maven Java project. I'll specify the package as PacktCassDev. Then, we'll need to make sure that our pom.xml file is configured with the desired version of the DataStax Java driver:

<dependencies>
<dependency>
<groupId>com.datastax.cassandra<...

Summary

This chapter was designed with a specific goal in mind—that of bridging the knowledge gap between Apache Cassandra DBAs and software developers. Often, developers only have experience with relational databases, and sometimes not even that much.

This chapter was as much about educating developers as it was about providing perspective for the DBAs. That is to say, as a DBA sometimes it is important to see the world through the eyes of your dev team.

We started out in this chapter by covering correct use cases and database selection. Then we began to discover the DataStax Java driver, its behaviors and configurations, and how it interacts with Apache Cassandra.

Finally, we built a series of short programs of increasing complexity. Each program used the same connection class, and iteratively explained how to get from problem definition to program execution.

...
lock icon
The rest of the chapter is locked
You have been reading a chapter from
Mastering Apache Cassandra 3.x - Third Edition
Published in: Oct 2018Publisher: PacktISBN-13: 9781789131499
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Authors (3)

author image
Aaron Ploetz

Aaron Ploetz is the NoSQL Engineering Lead for Target, where his DevOps team supports Cassandra, MongoDB, and Neo4j. He has been named a DataStax MVP for Apache Cassandra three times and has presented at multiple events, including the DataStax Summit and Data Day Texas. Aaron earned a BS in Management/Computer Systems from the University of Wisconsin-Whitewater, and an MS in Software Engineering from Regis University. He and his wife, Coriene, live with their three children in the Twin Cities area.
Read more about Aaron Ploetz

author image
Tejaswi Malepati

Tejaswi Malepati is the Cassandra Tech Lead for Target. He has been instrumental in designing and building custom Cassandra integrations, including a web-based SQL interface and data validation frameworks between Oracle and Cassandra. Tejaswi earned a master's degree in computer science from the University of New Mexico, and a bachelor's degree in electronics and communication from Jawaharlal Nehru Technological University in India. He is passionate about identifying and analyzing data patterns in datasets using R, Python, Spark, Cassandra, and MySQL.
Read more about Tejaswi Malepati

author image
Nishant Neeraj

Nishant Neeraj is an independent software developer with experience in developing and planning out architectures for massively scalable data storage and data processing systems. Over the years, he has helped to design and implement a wide variety of products and systems for companies, ranging from small start-ups to large multinational companies. Currently, he helps drive WealthEngine's core product to the next level by leveraging a variety of big data technologies.
Read more about Nishant Neeraj