In the 21st century, Data work as fuel for companies to run. Some companies generate data on a vast scale, but some cause a little less. Nevertheless, all data needs space to be stored. In the fast-forward era, it is required to make the data available to the user instantly, and also provide them real-time results is a tough ask. So the companies look for a platform that is highly responsive, offers high availability, ensures low latency, and stores data of any volume.
Two such databases that stand out on these standards are Google Spanner and Microsoft CosmosDB. The topics covered in this blog are.
- Google Spanner
- Google Spanner Architecture
- Google Spanner Features
- Google Spanner Case Study
- Microsoft CosmosDB
- Components in an Azure CosmosDB Account
- Microsoft CosmosDB Features
- Microsoft CosmosDB Case Study
- Google Spanner vs Microsoft CosmosDB
- Conclusion
Google Spanner
When Google’s traditional database could not handle the amount of data generated, the company created a new distributed database known as Spanner. Spanner is designed to provide database services as well as storage services. It stores enormous structured data, helps in performing queries with consistency. Also, Google Spanner assists in conducting universe transactions through different tables, columns, databases, and rows. The process of replication is consistent and synchronised with time. It also makes read operations and automatic failover management persistent.
Google Spanner Architecture
Google Spanner consists of regions, and each region can have three or more Shrad. Spanner will contain a zone, and each zone will contain a Shrad. Google Spanner Architecture is based on the Paxos Algorithm that helps in data partitioning across different servers. To maintain global consistency, it makes use of clock synchronisation. Similarly, Atomic and GPS clocks provide helping hands in the clock synchronisation process.
It consists of four ‘time servers’, out of which two are dedicated to GPS, and the other two are devoted to oscillators. Oscillators help manage failover and are in sync with the GPS server to match time across datacentres. To generate timestamps, Spanners use cloud Infrastructure known as TrueTime. Whenever a write operation is performed, Spanner takes the value of TrueTime; the timestamp builds the write operation order for execution.
Google Spanner Features
The key feature of Google Spanner are listed below:
- Consistency – Google Spanner is built to provide global consistency during the transactional procedure.
- Automatic Management – Google Spanner helps in conducting deployment operations very quickly. It also has a built-in automated system for maintaining and performing synchronous replication.
- Easy configurations – Google Spanner is very consistent in reading and writing data of any volume from anywhere on the globe. It helps databases to overcome regional failure and helps in providing maximum availability.
- Built-in network – As Google Spanner is built particularly on a dedicated network, it provides reliability, security, and low latency over the entire globe.
- Support for Multi-Language – Google Spanner supports libraries in many languages like Go, Node.js, Python, Java, C#, C++.
- Security – Google Spanner provides protection in many ways. It has data-layer encryption technology and IAM integration for control and provides access and authorisation.
- No downtime – Google Spanner provides flexibility in making changes to the schema/code without any downtime. It helps in converting the database without stacking application availability.
- Restore and Back-up Management – Google Spanner has PITR (Point-in-time-recovery) method to protect and recover data at the microsecond level.
- Automatic Partitioning – Partitioning called Sharding is conducted in Google Spanner, where it shards the data according to size and load request.
- Relational Database – Google Spanner is a relational database and can conduct SQL queries, schemas, testing, and ACID transactions.
Google Spanner Case Study
BlockChain’s adoption of Google Spanner
BlockChain, a company based in the United Kingdom, is one of the leading providers of cryptocurrency software. BlockChain has achieved 30 % in savings as it replaced traditional database layers and shifted data to the spanner. It has replaced its 1/3 of infrastructure into Google Spanner.
The Platform Engineering Head – Lewis Tuff, said that with the help of Google Spanner, they had been able to amend nodes. It helped in providing strong consistency and distributed database. He also added that they find Google Spanner as one of the most cost-effective solutions that help to scale data on-demand.
Google Spanner has provided the following result to BlockChain Company:
- Blockchain now conducts data restoration procedures in 9 hours compared to one week before adapting Spanner.
- Google Spanner has helped the company reduce its resource needs and save expenses.
Note: Know more about Google Spanner benefits.
Now let’s dive into Microsoft CosmosDB and see what it offers!
Microsoft CosmosDB
CosmosDB is offered by Microsoft and is a Platform as a Service (PaaS). It is regarded as NoSQL cloud-based database. CosmosDB also contains an Azure Document database and is accessible for all the Azure Regions. The data in CosmosDB is distributed and replicated globally.
In CosmosDB, capacity management, automatic scaling, and serverless databases help match demand with storage capacity. CosmosDB provides a solution for mobile, IoT applications, gaming, and the web that requires a considerable storage platform.
Component in an Azure CosmosDB Account
The Microsoft CosmosDB architecture consists of the following components that are explained below:
Cosmos Databases
Under a single Azure subscription, the user can create 50 Cosmos account. This account can further contain a database with various containers. The main functionality of the database is to manage the group of the container. Interaction with the database occurs with the help of Cosmos APIs that include SQL API, MongoDB API, Cassandra API, Gremlin API, Table API, and Azure CLI.
Container
Container in the CosmosDB is the mark of scalability for storage and throughput. The logic key helps in container partition and is replicated on different Azure regions. Items are created inside the container that automatically gets grouped based on the partition key. There are two modes through which users can develop containers: the shared throughput and the dedicated throughput. The operations performed on the container are data enumeration, deletion of creation, creating a new container, read container, and update container.
Items
Items are created inside the container. Item in CosmosDB depends on the type of API used. It can act as an edge, a graph node, table row, or a document. The operations that are performed by the item include: Insert, Upsert, Replace, Read, and Deletion of data.
Consistency Level
Microsoft Cosmos DB achieves the database architecture with the help of ‘consistency level’.It provides five types of consistency levels viz Prefix, Strong, Session, Eventual, and Bounded Staleness. Also, with consistency, all database replicas are maintained in synchronisation.
Microsoft CosmosDB Features
The vital features of Microsoft CosmosDB are listed below:
- Scalability – With the linear scalability feature, the required number of servers are added to manage the increased load.
- Indexing – CosmosDB can manage the data without any schema management procedure. It helps conduct automatic indexing without the need for an index management mechanism.
- Great Language Support – SDKs in Microsoft help support various languages like JavaScript, Java, Python, Node.js, etc.
- Low-latency – CosmosDB provides a latency of 10 milliseconds and hence helps distribute data to any geographical location, making it available for the customers whenever they need it.
- Multiple API support – CosmosDB supports various APIs like SQL API, MongoDB API, Cassandra API, Gremlin API, and Table API that helps in easy functionality.
- Multi-Master- With the help of the Multi-Master model, read and write operations can be scaled across any Azure region.
Microsoft CosmosDB Case Study
Let’s look at a case study of jet.com that has shifted from its traditional database to Microsoft CosmosDB.
Jet.com’s migration to Microsoft CosmosDB
The jet company is an e-commerce website and subsidiary of Walmart.com. The company faced issues with its inventory management, product pricing, and order processing. The company wanted to gain more data insights for their operation and marketing team. So, it tried to create a single and unified inventory management system. J CosmosDB proved to be a one-stop solution for event processing and event storage. CosmosDB has provided many benefits to the company that includes:
- The company had managed and configured the 10 million user requests in one second.
- Change Feed mechanism is used to address the issue of event sourcing.
- Due to its 99.99 % availability feature, the company can deploy the data across multiple regions.
Note: Know more about Microsoft CosmosDB benefits.
Google Spanner vs Microsoft CosmosDB
Conclusion
Both the databases are compatible and provide similar features with just a few variations. It will be a tough call for the company to choose between Google Spanner and Microsoft ComosDB to shift from its traditional databases to cloud databases. To opt between Google Spanner and Microsoft CosmosDB is like selecting between chocolates and cookies. But it is suggested that before choosing any platform, one should be aware of the features and limitations. Hence in this blog, we have tried to clear that air of doubt.
Related References
- GCP Associate Cloud Engineer: All You Need To Know About
- GCP Professional Cloud Architect: Everything You Need To Know
- Introduction To Google Cloud Platform
- Google Cloud Services & Tools
- Google Cloud Storage And Database Services Rundown
Next Task For You
If you are also interested and want to know more about the Google Cloud Associate Cloud Engineer certification, join and register for our Free Class.
The post Google Spanner vs Microsoft CosmosDB: Architecture and Benefits appeared first on Cloud Training Program.