Khi partition key trong Azure Cosmos DB gây ra truy vấn chéo partition hoặc hot partition, bạn có bốn lựa chọn: sử dụng tính năng "Change partition key" trên portal (ít nỗ lực nhất), sao chép container qua CLI (có thể online/offline), hoặc di cư tùy chỉnh bằng bulk ingestion, Azure Data Factory/Spark cùng Change Feed (tùy chỉnh cao nhất). Nếu chỉ vấn đề nằm ở read pattern, Global Secondary Index (GSI) sẽ tạo container read-only, tự động đồng bộ với partition key mới mà không ảnh hưởng đến nguồn. Bài viết cũng phân tích điều kiện tiên quyết, đánh đổi (chi phí RU, TTL, tính nhất quán) và cung cấp bảng quyết định để chọn phương pháp phù hợp.
Vì sao nên đọc: Lập trình viên nên đọc bài này để giải quyết hiệu quả vấn đề phân vùng không hiệu quả trong Cosmos DB, từ các giải pháp đơn giản đến phức tạp, giúp tối ưu hóa chi phí và hiệu suất cho ứng dụng của mình.
Trả lời 3 câu hỏi ngắn để nhận điểm thưởng cho bài này. Chỉ làm khi bạn muốn lấy điểm.
3 câu hỏi · dưới một phút · không bắt buộc
Nguồn: https://devblogs.microsoft.com/cosmosdb/need-a-different-partition-key-in-azure-cosmos-db-pick-the-right-approach. 8sync News chỉ tóm tắt và dẫn link; bản quyền nội dung thuộc tác giả và nguồn gốc.
DynamoDB là cơ sở dữ liệu NoSQL dạng key-value của AWS, phù hợp cho các ứng dụng yêu cầu thông lượng cao và độ trễ thấp như gaming, streaming, ngân hàng, ứng dụng di động/web và IoT. Nó cung cấp khả năng mở rộng ngang, linh hoạt schema và sao chép toàn cầu, với hai tùy chọn định giá (provisioned/on-demand) và gói miễn phí 25 RCU, 25 WCU cùng 25 GB lưu trữ.
Lập trình viên cần đọc bài này để hiểu cách tối ưu hóa DynamoDB cho các ứng dụng thực tế, từ việc lựa chọn mô hình dữ liệu cho đến cách kết hợp với công cụ phân tích để tránh rủi ro về chi phí và hiệu suất trong các dự án serverless.
A MongoDB expert walks through the first optimization step for a slow aggregation pipeline in a video streaming service use case. The pipeline was originally designed with an RDBMS mindset, using two unnecessary $unwind stages after $lookup joins. The key insight: when $lookup's localField points to a field inside array elements, MongoDB automatically runs the join for each element — making the preceding $unwind redundant. The second $unwind, used to filter out empty arrays, was replaced with a simpler $match stage. Removing both $unwinds also eliminated the need for a subsequent $group stage, reducing the pipeline from 10 to 8 stages. The result was a 60% performance improvement, dropping average query time from 11.8 seconds to 4.7 seconds, though still short of the 1-second SLA target.
A MongoDB expert walks through a real-world design review where a team modeled their data in an RDBMS-like fashion, resulting in 11.8-second query times. The post details a video streaming service use case with profiles, devices, and mappings collections, explaining each stage of a 10-stage aggregation pipeline ($match, $lookup, $unwind, $group, $sort, $skip, $limit). The initial pipeline suffered from poor performance despite proper indexing. Through data model and pipeline redesign, query time was reduced from 11.8 seconds to 14 milliseconds — an 800x improvement. Part 1 focuses on understanding the initial pipeline design before optimizations are introduced in subsequent parts.
A practical guide to setting up keyless access to Azure Cosmos DB using managed identities and data plane RBAC. Covers the three key questions for access control: who (managed identity), what (built-in data roles), and where (scope). Explains the critical distinction between control plane and data plane RBAC, walks through assigning the built-in Data Contributor role via Azure CLI, and shows how to use DefaultAzureCredential in the .NET SDK to authenticate without connection strings or secrets.