A developer needs to store unstructured sensor data (JSON format) from IoT devices into Azure. Each data point includes a `DeviceId`, a `Timestamp`, and various sensor readings. The data will be queried based on `DeviceId` and `Timestamp` ranges. The solution must support rapid ingestion of millions of data points per second, scale globally, and allow for flexible schema changes. Which Azure storage service is best suited for this scenario?
- AAzure SQL Database
- BAzure Table Storage
- CAzure Blob Storage
- DAzure Cosmos DB (SQL API)
Show answer & explanationAnswer & explanation
Correct answer: D. Azure Cosmos DB (SQL API)
Azure Cosmos DB (SQL API) is a globally distributed, multi-model database service that offers schema-agnostic capabilities, allowing for flexible schema changes for JSON data. It supports rapid ingestion of millions of data points per second and provides excellent query capabilities for `DeviceId` and `Timestamp` ranges, especially when designed with an appropriate partition key. Its global distribution features also meet the scalability requirement.
Why the other options are wrong
- A. Azure SQL Database is a relational database and would struggle with schema flexibility for unstructured JSON, global scale for millions of writes per second, and would require more complex data modeling for this type of IoT data.
- B. Azure Table Storage is a NoSQL key-value store with a rigid schema (PartitionKey, RowKey) and less flexible query capabilities for complex JSON, and it's not designed for millions of writes per second at a global scale like Cosmos DB.
- C. Azure Blob Storage is object storage, suitable for storing large files but not optimized for querying structured JSON data within blobs or rapid, transactional ingestion of millions of individual data points per second directly into a queryable database.
Cosmos DB for IoT Data
Azure Cosmos DB is well-suited for IoT data ingestion and processing due to its globally distributed, highly scalable, and schema-agnostic nature. Its ability to handle high write throughput and offer low-latency reads makes it ideal for storing time-series sensor data.
- Schema-agnostic (JSON document model).
- Globally distributed, multi-region capabilities.
- High write throughput (millions of operations/sec).
- Low-latency reads and rich query API.
- Time-to-Live (TTL) for automatic data expiry.
Memory trick: Cosmos Captures Constant Change and Queries.