When To Use NoSQL?
Today every organization is going through a massive technology shift in one way or the other in terms of cloud computing, mobile apps, web, IoT or big data. These are the technologies driving their business. These applications drive the way companies interact with their customers and vise-a-versa. Customer experience is delivered and judged through these digital apps. This experience defines how satisfied the customers are and if they will be loyal to organization thus directly impacting organizations bottom line.
The key difference between these applications from the legacy applications are
- These applications are driven by large customer base
- They require frequent changes
- Go to market time frame is very less
- The overall application latency is less. They need to be fast and highly responsive
- These applications store huge amount of data
- They should handle structured as well as unstructured data
- 24×7 availability
- These applications should scale on demand
As previously described in some of my NoSQL & MongoDB blogs, traditional relational databases cannot handle most of these requirements. This is where NoSQL technology comes as a savior.
NoSQL technology has below characteristics that can overcome above listed challenges:
- Schema less data model: In today’s digital world there are continuous and frequent changes in business requirements. Any technology should be agile enough to accommodate those changes with minimum of development efforts and time. Traditional RDBMS, due to their characteristics of define data model first, does not fit well. Once the data model is defined, it is more or less static. It is really difficult to change the data model based on new requirements. Moreover it’s very time consuming.
With NoSQL, you can define data model on the go in a document oriented fashioned. It’s dynamic. The ownership of defining the data model is on the application & services developers. The data model is driven & defined by the application model. Thus it very well suites the agile methodology for fast application development & deployments.
- Scalability: Today’s applications cater to huge customer base. This means, the applications need to store huge amount of data, need to be available 24×7 and it should scale to maintain high performance. Applications need to scale on demand. RDBMS systems are difficult to scale on demand because one has to scale up instead of scale out. This puts additional burden on operational costs in upgrading RDBMS systems due to expensive hardware. Moreover scale up architecture is more complex and time consuming.
In contrast, NoSQL databases take scale out architecture approach. This means that when we face any of the scalability issues, one can add commodity hardware to meet increasing demands.
- Reliability & Availability: Today’s customers are distributed across globe. That means your applications need to be available 24×7 with zero downtime. This is quite a challenge for relational databases. Moreover if the database is on single server or on cluster with shared storage, they are prone to single point of failure. Relational databases require considerable amount of effort to replicate data for high availability. Most of the time this either achieved through extra software built to replicate data.
NoSQL databases are based on distributed architecture. Data can be stored across multiple shards across multiple database instances. Replication is also in-built. Data could be replicated within same sharded cluster or it could be replicated across multiple data centers. This is really helpful to ensure seamless read & writes even if any node goes down. Moreover this also boosts performance as these reads & writes can be redirected to the nearest user location. This overall distributed architecture design helps ensure reliability & 24×7 availability of applications. Thus improving customer experience.
Some of the use cases where NoSQL can be used:
- 360 degree view of customer
- Real time operational analytics
- Call detail record (CDR) management
- Financial trade monitoring
- Big Data solutions
- Mobile apps
- Cloud based solutions
Having described above benefits of NoSQL, one should also consider when to avoid using NoSQL? Some of the common scenarios I could think of are:
- Transactional systems: NoSQL does not support or guarantees ACID properties. This has to be handled at application level. The onus is on application developers to ensure that transaction is complete. This puts additional complexity on developer’s part. So any financial applications are not a good use case to use NoSQL
- If data integrity & consistency is required and data is not going to change in terms of volume, relational databases still score over NoSQL
- If you have requirement of querying data through complex queries, RDBMS is still best option