简体   繁体   English

性能Azure弹性池数据库

[英]Performance Azure Elastic pool databases

We're running in to a similar issue as mentioned in Azure hits database cpu limits too easily . 我们正在遇到类似于Azure命中数据库cpu限制中提到的类似问题。 We are also using the Azure Elastic pool and are creating a new database for each customer. 我们还使用Azure Elastic池,并为每个客户创建一个新数据库。 We use EF6-code-first to handle the SQL stuff. 我们首先使用EF6-code来处理SQL的东西。

Using the web front-end an user can create a customer. 使用Web前端,用户可以创建客户。 They do this several times a week and sometimes (not always but certainly ones a week) the database is only created partially and we get Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement errors. 他们每周都会这样做几次,有时候(并不总是,但肯定是一周)数据库只是部分创建,我们得到Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement错误。 When we delete this client/db and create again it works fine. 当我们删除此客户端/数据库并再次创建它工作正常。 Of course this is very annoying. 当然这很烦人。 We are now working on catching this error, delete the db and restart the creating in code. 我们现在正在努力捕获此错误,删除数据库并重新启动代码中的创建。 This anybody have similar experience and hopefully a better solution? 这有谁有类似的经验,希望更好的解决方案?

Also creating the database takes a long time: 3-5 minutes. 创建数据库也需要很长时间:3-5分钟。 We only have 18 tables per database. 每个数据库只有18个表。 Can we speed this up? 我们可以加快速度吗?

Next step in the workflow is to parse XML-files the user has uploaded. 工作流程的下一步是解析用户上传的XML文件。 We use EF6 to fill our model and save it to the database. 我们使用EF6填充模型并将其保存到数据库中。 This is really slow. 这真的很慢。 The XML-file contains employee-data we need to fill into several tables (around 15 tables). XML文件包含我们需要填写几个表(大约15个表)的员工数据。 For example we have a 9.7MB XML-file containing 4416 employees and the '.save()' step takes about 12 min. 例如,我们有一个包含4416名员工的9.7MB XML文件,“.save()”步骤大约需要12分钟。 Taking into account that a client has around 25 XML-files each year and the user in uploading 5 years at once this saving takes too long. 考虑到客户每年大约有25个XML文件,并且用户一次上传5年,这种节省需要太长时间。

We already looked at the code and withing the boundaries of EF6 we don't think we can optimize it more. 我们已经看过代码并且考虑到EF6的界限,我们认为我们不能对它进行更优化。 We're now looking at the configuration of our Azure subscription but documentation is scares and we cannot figure out what to change to get a better performance. 我们现在正在查看Azure订阅的配置,但文档很恐慌,我们无法弄清楚要改进哪些内容以获得更好的性能。

Any guidance is much appreciated. 任何指导都非常感谢。

I cross-post this question on the Microsoft Azure > Azure SQL Database forum: https://social.msdn.microsoft.com/Forums/en-US/b7c7ad0a-0be4-4b15-8ae6-494181ec60b1/how-to-increase-max-number-of-databases-allowed-without-increasing-pricetier?forum=ssdsgetstarted And the answer is: 我在Microsoft Azure> Azure SQL数据库论坛上交叉发布此问题: https//social.msdn.microsoft.com/Forums/en-US/b7c7ad0a-0be4-4b15-8ae6-494181ec60b1/how-to-increase- max-of-databases-allowed-without-increase-pricetier?forum = ssdsgetstarted答案是:

You cannot scale partially (only certain resources) to another tier. 您无法将部分(仅限某些资源)扩展到另一层。 You cannot scale the maximum number of databases only. 您无法仅扩展最大数据库数。

This is not the answer I was hoping for. 这不是我希望的答案。

I have a cloud application which very similarly creates new customer instances with a new database shard. 我有一个云应用程序,它使用新的数据库分片非常类似地创建新的客户实例。 I have found that the code which creates these Azure databases must be VERY fault tolerant. 我发现创建这些Azure数据库的代码必须非常容错。 Here's what I do: 这是我做的:

  1. Use a very long timeout of at least 5 minutes when you create your database. 创建数据库时,请使用至少5分钟的超时超时。 It takes a long time to return. 返回需要很长时间。

  2. Wait even longer because even though the script ran and execution returned to your application, the database still isn't available for use yet. 等待更长时间,因为即使脚本运行并且执行返回到您的应用程序,数据库仍然无法使用。 I have a simple query that I run against the database every 10 seconds. 我有一个简单的查询,我每隔10秒对数据库运行一次。 At first, the query throws an exception when it runs; 首先,查询在运行时抛出异常; I catch the exception to prevent the error from bubbling up. 我捕获异常以防止错误冒泡。 After a while, the query will run successfully and you know the database is ready to receive requests. 一段时间后,查询将成功运行,您知道数据库已准备好接收请求。 I stop after 50 attempts to prevent an indefinite loop if Azure never successfully creates the table. 如果Azure从未成功创建表,我会在50次尝试之后停止以阻止无限循环。

Now, it's generally bad practice to use try/catches for regular program flow like this and to hit a resource over and over, however, this is the only approach that I've found that works 100% of the time for this problem. 现在,对于像这样的常规程序流使用try / catches并一遍又一遍地命中资源通常是不好的做法,但是,这是我发现100%的时间可以解决这个问题的唯一方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Azure弹性数据库池 - Azure Elastic Database Pool .NET 上 Azure 数据库的弹性查询 - Elastic Query for Azure Databases on VNET 是否可以更改 Azure 弹性池服务器版本 - Is it possible to change Azure Elastic Pool server version 扩展弹性池的 VCore(例如从 2 到 4)与使用 VCore(4)创建新池和移动数据库的延迟 - Latency in scaling VCore( say from 2 to 4) of Elastic Pool vs Create new Pool with VCore (4) and moving the databases 从 VM 将 database.bak 文件还原到 azure 弹性池数据库 - Restore database .bak file to azure elastic pool database from VM 为 azure 弹性池数据库设置自定义时区 - Setup custom time zone for azure elastic pool database Azure SQL 服务器错误:弹性池已达到其存储限制。 弹性池的存储使用量不能超过 (204800) - Azure SQL Server Error : The elastic pool has reached its storage limit. The storage usage for the elastic pool cannot exceed (204800) 同一服务器上的Azure SQL数据库会彼此影响性能 - Azure SQL databases on same server affect each other's performance 如何使用Azure的弹性数据库设置多租户? - How do you set up multi-tenancy with Azure's elastic databases? Azure 弹性池数据库 SQL 连接超时 - DTU 购买 model - Azure Elastic Pool Database SQL Connections are Timing Out - DTU Purchasing model
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM