Designing for semi-structured and unstructured data
Pick Cosmos DB, Table storage, Blob storage, Data Lake or Azure Files, then balance features, performance, cost and durability.
In this lesson you'll learn
- Storing semi-structured data: Cosmos DB APIs, consistency and capacity modes
- Storing unstructured data: blobs, Data Lake Storage, Azure Files and NetApp Files
- Balancing cost and performance with tiers and performance levels
- Protecting data: redundancy, soft delete, versioning and immutability
1. Semi-structured data
Refresher: what "semi-structured" means
Semi-structured data, such as JSON documents or key-value pairs, has some structure but no fixed schema. Each record can have different fields. It's common in web, mobile and IoT apps.
| Requirement | Recommend |
|---|---|
| Global app, single-digit millisecond reads, multi-region writes | Azure Cosmos DB for NoSQL |
| Existing MongoDB or Cassandra app, minimal code change | Cosmos DB for MongoDB or for Apache Cassandra |
| Graph relationships, such as a social network | Cosmos DB for Apache Gremlin |
| Simple key-value data at the lowest cost | Azure Table storage (or Cosmos DB for Table for global distribution) |
Consistency levels
From strongest to weakest: Strong, Bounded staleness, Session (the default: a user always sees their own writes), Consistent prefix and Eventual. Stronger consistency means higher latency and lower availability for writes across regions.
Capacity modes
Provisioned throughput (with optional autoscale) for steady or predictable traffic, and serverless for light, spiky or dev workloads, billed per request unit used.
2. Unstructured data
| Requirement | Recommend |
|---|---|
| Images, video, backups and documents accessed over HTTP | Blob storage |
| Big-data analytics with folders and POSIX permissions | Data Lake Storage (hierarchical namespace) |
| SMB or NFS file shares for lift-and-shift apps | Azure Files |
| Very high-performance NFS/SMB for enterprise apps such as SAP or HPC | Azure NetApp Files |
3. Balancing features, performance and cost
- Access tiers: hot, cool, cold and archive, moved automatically by lifecycle management rules.
- Performance: premium block blob accounts for low-latency, high-transaction workloads, and standard for everything else.
- Redundancy: choose the cheapest option that meets the resilience requirement.
- Reserved capacity: commit to storage for 1 or 3 years for a discount.
4. Protection and durability
| Protects against | Feature |
|---|---|
| Hardware, zone or region failure | Redundancy: LRS, ZRS, GRS, GZRS (RA- for readable secondary) |
| Accidental deletion | Soft delete for blobs, containers and file shares |
| Accidental overwrites | Blob versioning, point-in-time restore |
| Tampering, for regulatory retention | Immutable storage (time-based retention or legal hold) |
| Losing the whole account or malicious deletion | Azure Backup vaulted backup to a separate vault |
Example
A medical imaging company stores 2 PB of scans. New scans are read often for 30 days, then rarely, and must be kept unchanged for 10 years. The architect recommends Blob storage with GZRS, lifecycle rules moving blobs to cool after 30 days and archive after a year, and a time-based immutability policy of 10 years.
Exam traps to remember
- Session is Cosmos DB's default consistency. Strong consistency limits multi-region write designs.
- Redundancy protects against infrastructure failure, not against someone deleting data. You need soft delete or backup for that.
- Archive tier isn't available on ZRS, GZRS or RA-GZRS accounts.
- Data Lake Storage is Blob storage with the hierarchical namespace enabled, not a separate service.
Test yourself: 3 check questions and exam-style practice questions on this topic are in the AZ-305 Azure Solutions Architect app.
Practise in the app