顾 静

顾 静

1655983500

Azure SQL 数据库与 Azure Cosmos DB——你应该选择哪一个?

您最近是否开始开发或将应用程序移植到 Microsoft Azure?如果是这样,您可能必须决定的一件事是您要使用的数据库解决方案。Microsoft 云提供了多种选择,其中最流行的两个是 Azure SQL 数据库(及其两个兄弟,Azure SQL 托管实例和 Azure VM 上的 SQL Server)和 Azure Cosmos DB。

最近,我正在为我的应用程序比较这两种替代方案。我获得了一些我愿意与读者分享的见解。首先,让我们分别看看这两种产品,看看它们提供了哪些功能。

Azure SQL 数据库

Azure SQL 是 Microsoft 在 Azure 上提供的 SQL Server 产品。有三种与 Azure SQL 相关的服务可供选择:

  • Azure SQL 数据库
  • Azure SQL 托管实例
  • Azure VM 上的 SQL Server

Azure SQL 数据库是三者中最“托管”的服务。它是一种 PaaS 产品,使您能够快速轻松地设置 SQL Server。大多数管理任务,包括备份、更新和监控,都由您完成。您也不需要管理底层基础架构。

有多个服务层可供选择,包括具有可配置内存和计算的单个数据库选项、使您能够在多个数据库之间共享资源的弹性池选项以及可以根据使用情况动态扩展资源的无服务器选项。

Azure VM 上的 SQL Server 仅使您能够在自己预配的 Azure 虚拟机上运行 SQL Server 实例。这意味着您几乎可以完全控制部署的各个方面。这也意味着您将需要关心您习惯于在本地解决方案上执行的大多数管理任务。

Azure SQL 托管实例是这两者之间的一种混合。一方面,它使您能够将本地 SQL Server 数据库无缝传输到云中。另一方面,它为您提供了云的许多优势,包括改进的安全性、自动修补、版本更新和自动备份。

由于 Azure SQL 主要与 SQL Server 兼容,因此它还提供与本地产品相同的事务保证 (ACID)。由于这些强有力的保证,通过添加多个服务器实例进行横向扩展主要限于只读副本。Azure SQL 的异地复制功能也是如此。

Azure SQL 数据库的定价基于你需要的计算和内存 (vCore) 以及你配置的本地存储和备份存储。总体而言,定价似乎很容易理解。

Azure Cosmos 数据库

Cosmos DB 是 Azure 上的 NoSQL 产品。它从头开始设计以支持极高的可扩展性,完全接受最终一致性的概念。主要目标应用程序是物联网和面向全球的云应用程序。为此,Cosmos DB 提供了不同的一致性级别、数据访问方法 (API) 以及扩展选项。

由于 Cosmos DB 是一个 NoSQL 数据库,它通常很好地符合应用程序使用数据的方式。例如,可以将“项目”作为 JSON 文档插入数据库,查询的输出也是 JSON 文档。数据库和容器用作具有某些附加功能的项目的命名空间。

为了支持极端水平扩展,Cosmos DB 使用了多种机制。首先,Cosmos DB 根据分区键对每个容器进行分区。这些分区自动分布在物理节点上。此外,通过跨多个 Azure 区域部署数据来实现数据的全球分布。这减少了延迟并提高了全球范围内的响应能力。它还在区域中断期间提供故障转移。

可以理解的是,全球分布是以牺牲一致性为代价的。与默认提供强 ACID 保证的 SQL Server 相比,Cosmos DB 允许您在多个一致性级别之间进行选择,每个级别都提供其保证。其中最极端的最终一致性只能保证所有副本将在未来某个时间点收敛。

Cosmos DB 的定价模型基于请求单位 (RU)。1RU 是 1KB 点读取的成本。查询相应地更昂贵。请求单元看起来很简单,但是在没有经验的情况下很难估计使用情况给定您的特定数据访问模式。

优点和缺点

描述了这两种解决方案后,您可能会问哪一种最适合您?让我们讨论一下这两个数据库的一些优点和缺点。

Azure SQL 数据库专家

  • 灵活的部署选项。无论您想要完全托管的服务,还是只想在 Azure 的 VM 上运行 SQL Server,Azure SQL 数据库都能满足您的需求。
  • 熟悉SQL开发人员。由于 Azure SQL 数据库本质上是众所周知的 SQL Server 的 Azure 实现,因此大多数技能直接转移到云产品中。
  • 可定制性。如果您运行自己的 SQL Server 实例,则可以控制所有设置。
  • 透明的定价。定价基于所需的内存、计算和存储资源。
  • 移民。由于相同的底层引擎,将本地 SQL Server 数据库迁移到 Azure SQL 相对容易。
  • 稳定性和可靠性。Microsoft SQL Server 最初于 1989 年发布,从那时起已经走过了漫长的道路。它是一个成熟、稳定且经过良好测试的数据库引擎。

Azure SQL 数据库缺点

  • 固定架构。通常,SQL 数据库由于其固定模式不太适合频繁更改的软件需求。架构迁移可能难以管理。尽管 SQL Server 现在可以处理JSON 数据(从而缩小了 SQL 和 NoSQL 之间的差距),但它需要特殊的语法并且感觉有点像是事后才想到的。
  • ACID 保证和分布式事务。虽然这些功能对某些应用程序非常有用,但如果您不需要它们,它们也会大大降低可伸缩性。
  • 有限的缩放。虽然扩展(通过向 SQL Server 实例添加更多内存或计算)是提高性能的一种快速简便的方法,但超过某个点可能会变得非常昂贵。横向扩展(通过添加多个 SQL Server 实例)主要限于只读副本。

Azure Cosmos DB 专业人士

  • 全球分布。如今,许多公司在全球范围内开展业务。他们的客户无论身在何处,都希望应用程序具有相同的性能。这使得标准的 SQL 数据库模型非常低效。拥有一个具有多个只读副本的可写主节点对于诸如社交网络馈送或物联网数据流之类的任务来说是不够的。
  • 多个一致性级别。另一方面,这些应用程序通常不需要传统数据库的一致性保证。他们可以依赖较弱的一致性模型,例如一致的前缀甚至最终一致性。可以自由选择一致性级别是 Cosmos DB 的主要优势。
  • 自动索引支持。每个容器都设置了索引策略以加快查询速度。默认情况下,每个属性都被索引并强制执行范围索引。这对于大多数用例来说已经足够了。但是,可以使用高级索引设置。
  • 开箱即用支持多种语言。有现成的 API 可用于 .NET、Java、Python、Ruby 和 JavaScript。不需要复杂的 ORM 层。
  • 多个 API。Cosmos DB 提供了自己的核心 API 以及多个替代数据库 API(Gremlin API、Cassandra API、MongoDB API、表 API),以帮助从其他 NoSQL 数据库迁移。这降低了迁移成本和学习曲线。

Azure Cosmos DB 缺点

  • 对于传统的数据库管理员来说更难理解。由于 Cosmos DB 是一个 NoSQL 数据库,并且不一定提供强 ACID 保证(取决于配置),因此对于习惯于处理传统 SQL 数据库的数据库管理员来说,这很难理解。
  • 从 SQL Server 进行复杂的迁移。从基于 SQL Server 的解决方案迁移可能证明成本非常高,在极端情况下可能需要重写应用程序的主要部分。随后的优化将占用更多时间。如果全球扩展的好处超过了努力,我只会建议这样做。
  • 难以理解的定价模型。定价模型基于可能不直观的请求单位。如果您可以估计某些关键指标,则门户中的Cosmos DB 容量计算器可能有助于成本估计。一般来说,Cosmos DB 可能非常昂贵。
  • 仅限公共云。部署 Cosmos DB 的唯一地方是 Microsoft 的数据中心。目前,没有提供混合或本地云解决方案,例如 Azure Arc。

结论

这两种产品都在 Azure 生态系统中占有一席之地。虽然 Azure SQL 数据库提供从本地 SQL Server 解决方案的轻松迁移并帮助您利用现有的 SQL Server 知识,但 Cosmos DB 是为全球分发而设计的,并且是完全托管的。

如果我必须决定将哪个数据库用于新项目,我肯定会选择 Cosmos DB,因为我只是喜欢它的可扩展性和灵活性。作为一项 NoSQL 服务,与数据库交互在您的应用程序代码中感觉比使用传统数据库所需的复杂 ORM 中间件更自然。此外,多个一致性级别的选择使得在速度和一致性之间选择适当的平衡变得非常容易。

我对 Cosmos DB 的主要担忧是,对于习惯于处理传统 SQL 数据库的管理员来说,它的学习曲线陡峭。设置您的第一个 Cosmos DB 数据库让人感觉不知所措。您将不得不阅读大量文档或观看大量教程,以了解如何设置服务以满足您的特定要求。

但是,我认为随着采用率的提高,这种情况会随着时间的推移而改善。Cosmos DB 已经在很短的时间内取得了长足的进步,我迫不及待地想看看我们接下来的发展方向。

来源:https ://betterprogramming.pub/azure-sql-database-vs-cosmos-db-which-should-you-choose-cda17b60d6d2

#cosmosdb #azure #sql 

What is GEEK

Buddha Community

Azure SQL 数据库与 Azure Cosmos DB——你应该选择哪一个?
Cayla  Erdman

Cayla Erdman

1594369800

Introduction to Structured Query Language SQL pdf

SQL stands for Structured Query Language. SQL is a scripting language expected to store, control, and inquiry information put away in social databases. The main manifestation of SQL showed up in 1974, when a gathering in IBM built up the principal model of a social database. The primary business social database was discharged by Relational Software later turning out to be Oracle.

Models for SQL exist. In any case, the SQL that can be utilized on every last one of the major RDBMS today is in various flavors. This is because of two reasons:

1. The SQL order standard is genuinely intricate, and it isn’t handy to actualize the whole standard.

2. Every database seller needs an approach to separate its item from others.

Right now, contrasts are noted where fitting.

#programming books #beginning sql pdf #commands sql #download free sql full book pdf #introduction to sql pdf #introduction to sql ppt #introduction to sql #practical sql pdf #sql commands pdf with examples free download #sql commands #sql free bool download #sql guide #sql language #sql pdf #sql ppt #sql programming language #sql tutorial for beginners #sql tutorial pdf #sql #structured query language pdf #structured query language ppt #structured query language

Eric  Bukenya

Eric Bukenya

1624713540

Learn NoSQL in Azure: Diving Deeper into Azure Cosmos DB

This article is a part of the series – Learn NoSQL in Azure where we explore Azure Cosmos DB as a part of the non-relational database system used widely for a variety of applications. Azure Cosmos DB is a part of Microsoft’s serverless databases on Azure which is highly scalable and distributed across all locations that run on Azure. It is offered as a platform as a service (PAAS) from Azure and you can develop databases that have a very high throughput and very low latency. Using Azure Cosmos DB, customers can replicate their data across multiple locations across the globe and also across multiple locations within the same region. This makes Cosmos DB a highly available database service with almost 99.999% availability for reads and writes for multi-region modes and almost 99.99% availability for single-region modes.

In this article, we will focus more on how Azure Cosmos DB works behind the scenes and how can you get started with it using the Azure Portal. We will also explore how Cosmos DB is priced and understand the pricing model in detail.

How Azure Cosmos DB works

As already mentioned, Azure Cosmos DB is a multi-modal NoSQL database service that is geographically distributed across multiple Azure locations. This helps customers to deploy the databases across multiple locations around the globe. This is beneficial as it helps to reduce the read latency when the users use the application.

As you can see in the figure above, Azure Cosmos DB is distributed across the globe. Let’s suppose you have a web application that is hosted in India. In that case, the NoSQL database in India will be considered as the master database for writes and all the other databases can be considered as a read replicas. Whenever new data is generated, it is written to the database in India first and then it is synchronized with the other databases.

Consistency Levels

While maintaining data over multiple regions, the most common challenge is the latency as when the data is made available to the other databases. For example, when data is written to the database in India, users from India will be able to see that data sooner than users from the US. This is due to the latency in synchronization between the two regions. In order to overcome this, there are a few modes that customers can choose from and define how often or how soon they want their data to be made available in the other regions. Azure Cosmos DB offers five levels of consistency which are as follows:

  • Strong
  • Bounded staleness
  • Session
  • Consistent prefix
  • Eventual

In most common NoSQL databases, there are only two levels – Strong and EventualStrong being the most consistent level while Eventual is the least. However, as we move from Strong to Eventual, consistency decreases but availability and throughput increase. This is a trade-off that customers need to decide based on the criticality of their applications. If you want to read in more detail about the consistency levels, the official guide from Microsoft is the easiest to understand. You can refer to it here.

Azure Cosmos DB Pricing Model

Now that we have some idea about working with the NoSQL database – Azure Cosmos DB on Azure, let us try to understand how the database is priced. In order to work with any cloud-based services, it is essential that you have a sound knowledge of how the services are charged, otherwise, you might end up paying something much higher than your expectations.

If you browse to the pricing page of Azure Cosmos DB, you can see that there are two modes in which the database services are billed.

  • Database Operations – Whenever you execute or run queries against your NoSQL database, there are some resources being used. Azure terms these usages in terms of Request Units or RU. The amount of RU consumed per second is aggregated and billed
  • Consumed Storage – As you start storing data in your database, it will take up some space in order to store that data. This storage is billed per the standard SSD-based storage across any Azure locations globally

Let’s learn about this in more detail.

#azure #azure cosmos db #nosql #azure #nosql in azure #azure cosmos db

Ruthie  Bugala

Ruthie Bugala

1620435660

How to set up Azure Data Sync between Azure SQL databases and on-premises SQL Server

In this article, you learn how to set up Azure Data Sync services. In addition, you will also learn how to create and set up a data sync group between Azure SQL database and on-premises SQL Server.

In this article, you will see:

  • Overview of Azure SQL Data Sync feature
  • Discuss key components
  • Comparison between Azure SQL Data sync with the other Azure Data option
  • Setup Azure SQL Data Sync
  • More…

Azure Data Sync

Azure Data Sync —a synchronization service set up on an Azure SQL Database. This service synchronizes the data across multiple SQL databases. You can set up bi-directional data synchronization where data ingest and egest process happens between the SQL databases—It can be between Azure SQL database and on-premises and/or within the cloud Azure SQL database. At this moment, the only limitation is that it will not support Azure SQL Managed Instance.

#azure #sql azure #azure sql #azure data sync #azure sql #sql server

Creating and Cataloging SQL pools in Azure SQL Server

This article will walk you through creating a new SQL pool within an existing Azure SQL Server as well as catalog the same using the Azure Purview service.

Introduction

Data is generated by transactional systems and typically stored in relational data repositories. This data is generally used by live applications and for operational reporting. As this data volume grows, this data is often required by other analytical repositories and data warehouses where it can be used for referential purposes and adding more context to other data from across the organization. Transactional systems (also known as Online Transaction Processing (OLTP) systems) usually need a relational database engine, while analytical systems (also known as Online Analytical Processing (OLAP) systems) usually need analytical data processing engines. On Azure cloud, it is usually known that for OLTP requirements, SQL Server or Azure SQL Database can be employed, and for analytical data processing needs, Azure Synapse and other similar services can be employed. SQL Pools in Azure Synapse host the data on an SQL Server environment that can process the data in a massively parallel processing model, and the address of this environment is generally the name of the Azure Synapse workspace environment. At times, when one has already an Azure SQL Server in production or in use, the need is to have these SQL Pools on an existing Azure SQL Server instance, so data in these SQL pools can be processed per the requirements on an OLAP system as well as the data can be co-located with data generated by OLTP systems. This can be done by creating SQL Pools within the Azure SQL Server instance itself. In this article, we will learn to create a new SQL Pool within an existing Azure SQL Server followed by cataloging the same using the Azure Purview service.

Pre-requisite

As we intend to create a new SQL Pool in an existing Azure SQL Server instance, we need to have an instance of Azure SQL in place. Navigate to Azure Portal, search for Azure SQL and create a new instance of it. We can create an instance with the most basic configuration for demonstration purposes. Once the instance is created, we can navigate to the dashboard page of the instance and it would look as shown below.

As we are going to catalog the data in the dedicated SQL Pool hosted on Azure SQL instance, we also need to create an instance of Azure Purview. We would be using the Azure Purview studio from the dashboard of this instance, tonregister this SQL Pool as the source and catalog the instance.

#azure #sql azure #azure sql server #sql #sql #azure

Christa  Stehr

Christa Stehr

1603941420

Support for Synapse SQL serverless in Azure Synapse Link for Azure Cosmos DB

Co-authored by Rodrigo Souza, Ramnandan Krishnamurthy, Anitha Adusumilli and Jovan Popovic (Azure Cosmos DB and Azure Synapse Analytics teams)

Azure Synapse Link now supports querying Azure Cosmos DB data using Synapse SQL serverless. This capability, available in public preview, allows you to use familiar analytical T-SQL queries and build powerful near real-time BI dashboards on Azure Cosmos DB data.

As announced at Ignite 2020, you can now also query Azure Cosmos DB API for Mongo DB data using Azure Synapse Link, enabling analytics with Synapse Spark and Synapse SQL serverless.

Support for T-SQL queries and building near real-time BI dashboards

Azure Synapse SQL serverless (previously known as SQL on-demand) is a serverless, distributed data processing service offering built-in query execution fault-tolerance and a consumption-based pricing model. It enables you to analyze your data in Cosmos DB analytical store within seconds, without any performance or RU impact on your transactional workloads.

Using OPENROWSET syntax and automatic schema inference, data and business analysts can use familiar T-SQL query language to quickly explore and reason about the contents in Azure Cosmos DB analytical store. You can query this data in place without the need to copy or load the data into a specialized store.

You can also create SQL views to join data in the analytical stores across multiple Azure Cosmos DB containers, to better organize your data in a semantic layer that will accelerate your data exploration and reporting workloads. BI Professionals can quickly create Power BI reports on top of these SQL views in Direct Query mode.

You can further extend this by building a logical data warehouse to create and analyze unified views of data across Azure Cosmos DB, Azure Data Lake Storage and Azure Blob Storage.

 

#analytics #announcements #api for mongodb #core (sql) api #data architecture #query #azure cosmos db #azure synapse analytics #serverless sql pools #sql on-demand #synapse link #synapse sql serverless