惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Google DeepMind News
Google DeepMind News
V
Visual Studio Blog
博客园 - Franky
N
Netflix TechBlog - Medium
WordPress大学
WordPress大学
小众软件
小众软件
Jina AI
Jina AI
L
Lohrmann on Cybersecurity
罗磊的独立博客
I
Intezer
W
WeLiveSecurity
T
Tenable Blog
Cyberwarzone
Cyberwarzone
P
Privacy & Cybersecurity Law Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
S
Securelist
Recent Announcements
Recent Announcements
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Engineering at Meta
Engineering at Meta
Hacker News: Ask HN
Hacker News: Ask HN
F
Full Disclosure
S
SegmentFault 最新的问题
S
Security Affairs
L
LINUX DO - 热门话题
C
CERT Recently Published Vulnerability Notes
博客园 - 叶小钗
Stack Overflow Blog
Stack Overflow Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
S
Secure Thoughts
C
CXSECURITY Database RSS Feed - CXSecurity.com
The Register - Security
The Register - Security
月光博客
月光博客
Microsoft Azure Blog
Microsoft Azure Blog
Last Week in AI
Last Week in AI
PCI Perspectives
PCI Perspectives
N
News | PayPal Newsroom
Schneier on Security
Schneier on Security
T
Threat Research - Cisco Blogs
B
Blog RSS Feed
L
LINUX DO - 最新话题
F
Fortinet All Blogs
雷峰网
雷峰网
Security Latest
Security Latest
大猫的无限游戏
大猫的无限游戏
P
Palo Alto Networks Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
V
V2EX
人人都是产品经理
人人都是产品经理
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 【当耐特】

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
Azure Cosmos DB and Blob Storage: When SQL Is Not the Right Tool
Manohari Jayachandran · 2026-06-25 · via DEV Community

Every post on my blog so far has used Azure SQL - a relational database with a fixed schema, queried with standard SQL. That has been the right choice for the blog's Posts table, which is tabular and consistent in shape. But not every kind of data fits neatly into rows and fixed columns, and not every kind of content belongs in a database row at all. At Blue Yonder, I used Cosmos DB to hold operational and application data from an Azure-based integration platform, querying it with KQL to support troubleshooting and reporting - a genuinely different use case from a primary transactional database, and a good illustration of just how flexible the document model can be. This post covers the two Azure services worth reaching for when SQL genuinely is not the right fit: Cosmos DB for flexible, fast-changing JSON documents, and Blob Storage for files.

What Azure Cosmos DB Actually Is

Azure Cosmos DB is a fully managed NoSQL database built for global distribution and elastic scale. Instead of rows constrained to fixed columns, it stores JSON documents - and critically, each document can have a different shape from the next, even within the same container.

Azure SQL is a filing cabinet with labeled folders and a fixed form inside each one - every form has the same fields in the same order, every single time. Cosmos DB is closer to a box of index cards, where each card can hold completely different information structured however makes sense for that one card, while still letting you flip through the whole box quickly when needed.

A Concrete Comparison Using This Blog's Own Data

The Posts table in Azure SQL has a fixed set of columns - Id, Title, Slug, Tech, and so on. Every row shares exactly the same structure. Adding a genuinely new field - say, an array of structured code blocks with language tags - means altering the table schema for every single row, even posts that will never use that field.

The same data reshaped as a Cosmos DB document removes that constraint entirely. One document might carry a codeBlocks array with language and code properties. A different document might instead carry a relatedServices array and a diagramUrl pointing at an image. Neither document needs to match the other's shape, and no schema migration is required to introduce a field that only some documents will ever use.

Core Cosmos DB Concepts

An Account is the top-level Cosmos DB resource - a single account can actually support multiple APIs, including NoSQL, MongoDB, Cassandra, Gremlin, and Table, though the NoSQL API is the most commonly used and the one covered here. A Database is a logical grouping within an account, conceptually similar to a SQL database. A Container is roughly the document-world equivalent of a SQL table, but with no fixed schema enforced across the documents inside it. An Item, or document, is a single JSON object inside a container - roughly equivalent to a row, but with a
flexible shape.

The Partition Key deserves its own emphasis, because it is genuinely the single most consequential design decision in Cosmos DB. It is a property within your document used to distribute data across physical partitions for scale. Choosing poorly does not just create a minor inefficiency - it can cause real performance problems as data grows, because all writes for a given partition key value land on the same physical partition.

Choosing a Partition Key

For a hypothetical Posts container, several candidates illustrate the tradeoff clearly. Partitioning by technology tag works well if queries are usually filtered by technology, but risks creating a disproportionately large "Azure" partition if that tag dominates the content, which becomes a hot, oversized partition relative to the others. Partitioning by slug guarantees excellent distribution since every slug is unique, but querying "all posts" still requires a fan-out across every partition, which costs more in Request Units. Partitioning by year suits time-based access patterns well, but concentrates all of the current year's writes onto a single partition until the calendar turns over.

The actual rule underlying all of this: pick the property that aligns with the most frequent query pattern in your application, while also spreading data roughly evenly across many distinct values.

Querying Cosmos DB

Cosmos DB's NoSQL API uses a query language that visually resembles SQL but operates over JSON structure rather than table columns. Anyone who already knows SQL picks this up quickly. A query like selecting title, slug, and reading time from a container, filtering where a tech array contains "Azure", and ordering by reading time descending, reads almost identically to the equivalent Azure SQL query - the syntax is genuinely that close for simple cases.

Where it diverges meaningfully is querying into nested structures. Cosmos DB can join directly into an array nested inside the same document - for instance, finding every code block with a specific language tag, embedded inside posts - without needing a second table at all. The equivalent in a relational model requires an actual separate table and a real JOIN across tables, since SQL has no native concept of an array living inside a single row.

LINQ Against Cosmos DB

For anyone who has used Entity Framework Core's LINQ support against Azure SQL, querying Cosmos DB from C# will feel immediately familiar at the syntax level - Where, OrderByDescending, and the rest of the standard LINQ vocabulary all work against a Cosmos DB container through its LINQ provider. The vocabulary is the same. The engine underneath is completely different - EF Core generates T-SQL against a relational engine, while Cosmos DB's LINQ provider generates its own SQL-like query against a document store with an entirely different cost and performance model. Familiar syntax does not imply equivalent execution.

Request Units

Cosmos DB does not bill the way Azure SQL does, on compute tiers and DTUs or vCores. It bills on Request Units, a normalized measure of the cost of any given operation. A simple point read by id and partition key is roughly one Request Unit - the cheapest possible operation in the system. A broader query scanning many documents can cost tens or hundreds of Request Units depending on its complexity. Writes typically cost more Request Units than an equivalent read.

Two billing modes exist. Provisioned throughput reserves a fixed Request Unit per second capacity that is paid for whether it is fully used or not - appropriate for predictable, steady traffic. Serverless mode charges only for the Request Units actually consumed, with no fixed reservation at all - a far better fit for unpredictable, generally low-traffic workloads, which describes most personal blogs and small applications far more accurately than a fixed provisioned tier would.

When Cosmos DB Is The Right Choice Over Azure SQL

Cosmos DB earns its place when document shape varies significantly between items, when an application needs single-digit millisecond reads at genuinely global scale, when multi-region write distribution matters, when data is naturally hierarchical or nested in a way that maps cleanly to JSON, or when throughput needs to scale elastically and automatically without manual intervention.

Azure SQL remains the better choice when data is naturally tabular with a consistent shape across records, when strong relational integrity through foreign keys and joins across many related tables genuinely matters, when a team already thinks fluently in SQL and the data fits that model comfortably, or when complex multi-table transactions are a common part of the workload.

This blog's own Posts data is tabular and consistent in shape - Azure SQL remains the correct choice for it. Where Cosmos DB genuinely earns its place, based on real production experience, is somewhere quite different from "replace your application database": holding operational and log data from an integration platform, where one event might carry a handful of fields and another dozens, then querying that data with KQL for troubleshooting and reporting rather than serving it as primary application content. That pattern - flexible storage for fast-changing
operational data, queried for insight rather than served to end users - is worth knowing even for engineers who never touch Cosmos DB as a primary database.

What Azure Blob Storage Actually Is

Azure Blob Storage stores unstructured files - images, videos, PDFs, backups, log files - as objects called blobs, organized inside containers. It functions as neither a traditional database nor a traditional filesystem but remains accessible over HTTP in a way that feels filesystem- like in practice.

If Azure SQL and Cosmos DB are both filing systems built for structured information, Blob Storage is closer to a warehouse. There is no querying the contents of what sits inside a stored box - only knowing which box it is, after which the warehouse hands it over, whole, exactly as it was left.

Blob Storage Tiers

The Hot tier is optimized for frequently accessed data, carrying the highest storage cost paired with the lowest access cost - appropriate for something like images displayed on a blog's homepage that get requested constantly. The Cool tier suits infrequently accessed data intended to be stored for at least thirty days, trading lower storage cost for higher access cost relative to Hot - last month's exported analytics reports fit naturally here. The Archive tier suits data rarely accessed at all, intended for at least one hundred eighty days of storage, with the lowest storage cost and highest access cost of the three, plus the detail that data must be rehydrated before it can be read again, a process that can take hours - genuinely multi-year backups nobody expects to open belong here.

Blob Types

Block Blobs are the most common type, optimized for efficiently uploading large amounts of data in individually manageable blocks - the right choice for images, video, documents, and backups in the overwhelming majority of cases. Append Blobs are optimized specifically for append operations, allowing data to be added to the end without modifying what already exists - well suited to logging scenarios where new entries continuously accumulate. Page Blobs are optimized for random read and write access patterns, primarily relevant to virtual hard disk files backing virtual machines, a scenario that rarely comes up outside infrastructure-focused work.

SAS Tokens

Blob containers are private by default, which is the correct default. A Shared Access Signature, or SAS token, grants temporary, narrowly scoped access to a blob or container without making the entire container public and without sharing the storage account's actual access key. A SAS token can be constrained to a specific blob, a specific permission like read-only, and a specific expiration time - a token built to expire in one hour, granting read-only access to exactly one blob, does exactly that and nothing more once it expires.

Where This Blog Would Realistically Use Blob Storage

A few concrete, realistic use cases stand out for this specific project, none of which are implemented yet. Post cover images and inline diagrams currently rely on external links rather than self-hosted assets - Blob Storage would be the natural home for self-hosted images served from a stable URL. The Open Graph share image used for social previews is currently committed directly into the frontend code repository - it could instead live in Blob Storage behind a CDN, cleanly separating binary assets from application source code. Scheduled database backups, exported independently of Azure SQL's own built-in backup retention, would fit naturally in the Cool tier. And if a comments feature with image uploads is ever added, Blob Storage is precisely the right service for storing user-submitted files.

The Three Services, Side By Side

Azure SQL handles fixed-shape rows, queried in standard SQL, requiring a defined schema, and billed on a DTU or vCore model - the right fit for relational, structured data, which describes this blog's own Posts table accurately. Cosmos DB handles flexible JSON documents, queried in a SQL-like language suited to NoSQL access patterns, requiring no fixed schema, and billed on Request Units - the right fit for fast-changing documents that need global scale. Blob Storage handles raw files with no query language at all beyond retrieval by key, requiring no schema in the traditional sense, and billed per gigabyte stored plus per operation - the right fit for images, video, backups, and any other genuinely unstructured content.

Key Lessons

  • Choosing a Cosmos DB partition key is the single decision most likely to cause real performance problems later if made carelessly early on.

  • Serverless billing mode fits unpredictable, low-to-moderate traffic far better than provisioned throughput - defaulting to provisioned out of habit, without a real reason, adds cost without a corresponding benefit.

  • SAS tokens belong on any blob access that needs to be temporary or narrowly scoped - a fully public container should be reserved for content that is genuinely meant to be public without exception.

  • LINQ syntax transfers comfortably between EF Core and Cosmos DB, but the execution engine and cost model underneath are entirely different - familiarity with the syntax should not be mistaken for familiarity with the performance characteristics.

  • The actual skill is matching the shape of the data to the right service, not defaulting to whichever tool sounds newest or most powerful. A relational table remains exactly the right choice for plenty of real workloads, including this blog's own. And Cosmos DB's most valuable real-world use is not always "primary database" - operational and log data analysis, queried with KQL, is a pattern worth recognizing on its own.

Summary

Azure SQL fits data that is naturally tabular and relational. Cosmos DB fits data that is naturally document-shaped, fast-changing, or in need of global low-latency distribution. Blob Storage fits anything that is fundamentally a file rather than structured data at all. All three coexist comfortably within real Azure architectures - the genuine skill lies in matching the shape of the data to the right service, rather than selecting one tool and forcing every problem through it regardless of fit.


Originally published at TechStack Blog:
https://www.techstackblog.com/post.html?slug=azure-cosmos-db-blob-storage

More from TechStack Blog, by category:
Azure: https://www.techstackblog.com/category.html?cat=azure
Database: https://www.techstackblog.com/category.html?cat=database

Follow for weekly posts on Azure, C#, and cloud engineering.