Illustration Image

Cassandra + Spring at T-Mobile

Patrick McFadin on April 20, 2023

Cassandra + Spring at T-Mobile

As the fastest-growing US wireless carrier, T-Mobile serves around 80 million subscribers and employs over 52,000 people. To keep up with rapid growth and accommodate their expanding subscriber base, T-Mobile needed a robust, scalable database solution. In this blog post, we’ll explore T-Mobile’s journey with Cassandra, highlighting the challenges faced and lessons learned during their transition and integration process. We’ll also discuss the importance of proper design, configuration, and training to ensure smooth operation.

Transitioning from Oracle to Cassandra

Initially, T-Mobile relied exclusively on Oracle databases. However, scalability, active-active handling, and failover issues prompted the company to seek alternative solutions. After evaluating several options, including Couchbase and MongoDB, T-Mobile chose Cassandra for its always-on, near real-time replication, global distribution, and scalability capabilities. T-Mobile partnered with DataStax for enterprise support and advanced functionality to facilitate their transition.

Challenges in On-Premises Deployment

Opting for on-premises, bare metal hardware over cloud-based instances presented unique challenges for T-Mobile. The company had to manage multiple large stacks of metal across various data centers without any pre-baked images. Additionally, capacity planning proved difficult, as they had to build a system without knowing which applications would run on it or their workloads.

Configuring and Troubleshooting Cassandra

When implementing a new database like Cassandra, proper configuration and troubleshooting are essential to ensure optimal performance and stability. Here, we delve deeper into the configuration and troubleshooting process that T-Mobile faced when deploying Cassandra.

  1. Address Configuration: One of the initial challenges T-Mobile encountered was related to address configuration in Cassandra. Configuring the correct addresses for nodes and seeds is crucial for cluster communication and proper functioning. T-Mobile had to make adjustments to their address configuration and consult with professional services to address this issue.
  2. Data Modeling and Schema Design: T-Mobile’s experience highlighted the importance of getting the data model and schema design right from the beginning. Cassandra’s data model is different from relational databases, and designing an efficient schema that optimizes read and write performance is critical. Poorly designed schemas can lead to issues like read and write hotspots and difficulty in scaling the system.
  3. Tuning and Optimization: Another aspect of configuring Cassandra is the tuning and optimization of various settings, such as compaction strategy, cache settings, and JVM options. T-Mobile needed to find the right balance between read and write performance, memory usage, and disk space to ensure optimal performance of their Cassandra cluster.
  4. Monitoring and Alerting: Setting up proper monitoring and alerting for Cassandra is crucial to detect and address issues before they escalate. T-Mobile had to configure their monitoring and alerting tools to track various metrics, such as latency, request rates, and error rates, and set up appropriate thresholds for triggering alerts.
  5. Security and Authentication: Configuring security and authentication settings is essential to protect data and control access to the Cassandra cluster. T-Mobile had to set up user authentication, authorization, and encryption options to secure their data and comply with relevant regulations.
  6. Backup and Recovery: T-Mobile needed to configure backup and recovery options for their Cassandra cluster to ensure data durability and protection against data loss. This involved setting up regular snapshots, incremental backups, and procedures for restoring data in case of failures.
  7. Troubleshooting Failovers: T-Mobile encountered issues during failovers, which required investigation and resolution. Failovers can occur due to various reasons, such as hardware failures, network issues, or software bugs. Identifying the root cause and taking corrective actions to minimize downtime and data loss is crucial in maintaining a reliable and available database system.
  8. Performance Testing and Benchmarking: To ensure that their Cassandra deployment met performance and scalability requirements, T-Mobile needed to conduct performance testing and benchmarking. This process involved simulating different workloads, measuring response times, and identifying bottlenecks and areas for optimization.

Configuring and troubleshooting Cassandra is a complex process that involves addressing various aspects, such as address configuration, data modeling, tuning, monitoring, security, and failover handling. T-Mobile’s experience highlights the importance of proper configuration and troubleshooting to ensure the smooth and efficient operation of a Cassandra deployment.

Integrating Cassandra with Spring Framework

The Spring Framework, particularly Spring Boot and Spring Data, simplifies the process of developing and deploying applications that interact with databases like Cassandra. However, integrating Cassandra with the Spring Framework can still present challenges. Here, we discuss the aspects of integrating Cassandra with the Spring Framework and some key considerations.

  1. Spring Boot: Spring Boot makes it easy to create stand-alone, production-grade applications with minimal setup and boilerplate code. It offers pre-configured templates, auto-configuration, and dependency management that simplify the process of developing applications. When integrating with Cassandra, Spring Boot provides built-in support for connecting to the database, managing sessions, and handling configurations. However, developers may need to fine-tune certain settings to optimize performance and ensure compatibility with their specific use case.
  2. Spring Data Cassandra: Spring Data Cassandra is a module within the Spring Data project that provides an abstraction layer for working with Cassandra. It offers a high-level, object-mapping API that simplifies the process of querying and manipulating data in Cassandra. Developers can use repository interfaces, query methods, and template classes to interact with the database without writing low-level code.

Challenges and Considerations:

  1. NoSQL Nature: One challenge when integrating Cassandra with the Spring Framework is adapting to the NoSQL nature of Cassandra. Developers with a background in relational databases may find it difficult to adjust to the different data model, query language (CQL), and consistency model.
  2. Default Configurations and Tombstone Handling: Spring Data Cassandra’s default configurations may not be optimal for all use cases. For example, handling tombstones (markers for deleted records) can become problematic if not properly managed. Developers may need to adjust configurations related to compaction, garbage collection, and read repair to minimize the impact of tombstones on performance and disk space.
  3. Handling Null Values and Batches: Spring Data Cassandra handles null values and batch operations differently than relational databases. For instance, inserting null values into a Cassandra table will result in a tombstone, which could lead to performance issues. Developers must be aware of these differences and adjust their application code and data model accordingly.
  4. Query Optimization: While Spring Data Cassandra simplifies querying, it is essential to optimize queries for performance. Understanding the implications of using lightweight transactions, secondary indexes, and materialized views is crucial for efficient querying in a Cassandra and Spring Framework integration.
  5. Pagination and Data Retrieval: When working with large datasets, developers need to implement efficient pagination and data retrieval techniques. Spring Data Cassandra provides built-in support for pagination, but developers should be aware of potential performance issues and choose the most suitable approach for their use case.

Integrating Cassandra with the Spring Framework, particularly Spring Boot and Spring Data, can greatly simplify the development process. However, developers need to be aware of the unique aspects and challenges associated with Cassandra’s NoSQL nature and make necessary adjustments to their application code and configurations to ensure smooth operation and optimal performance.


T-Mobile’s journey with Cassandra provides valuable insights into the challenges and lessons learned when transitioning to and integrating a new database solution. The company’s experience underscores the importance of proper design, configuration, and training for smooth operation. By understanding and addressing these challenges, other organizations can more effectively implement and optimize their use of Cassandra and other similar technologies.

Become part of our
growing community!
Welcome to Planet Cassandra, a community for Apache Cassandra®! We're a passionate and dedicated group of users, developers, and enthusiasts who are working together to make Cassandra the best it can be. Whether you're just getting started with Cassandra or you're an experienced user, there's a place for you in our community.
A dinosaur
Planet Cassandra is a service for the Apache Cassandra® user community to share with each other. From tutorials and guides, to discussions and updates, we're here to help you get the most out of Cassandra. Connect with us and become part of our growing community today.
© 2009-2023 The Apache Software Foundation under the terms of the Apache License 2.0. Apache, the Apache feather logo, Apache Cassandra, Cassandra, and the Cassandra logo, are either registered trademarks or trademarks of The Apache Software Foundation.

Get Involved with Planet Cassandra!

We believe that the power of the Planet Cassandra community lies in the contributions of its members. Do you have content, articles, videos, or use cases you want to share with the world?