简体   繁体   English

如何使用Azure通过Web服务加快数据性能的插入

[英]How to speed up insertion of data performance via web service with Azure

I am trying to insert 6000 rows into a database. 我试图将6000行插入数据库中。 It takes around 1 minute for that operation. 该操作大约需要1分钟。

My architecture is as follow: 我的架构如下:

Console app -> Web service with endpoints -> sql database 控制台应用程序->具有端点的Web服务-> sql数据库

Console app is running as a webjob on Azure, and is using Premium 3(P3) plan with 1 instance scale out. 控制台应用程序作为Webjob在Azure上运行,并使用具有1个实例扩展的Premium 3(P3)计划。 Console app is using Parallel.For for faster insertion. 控制台应用程序正在使用Parallel.For以便更快地插入。

Web service endpoint is using P3 plan with 8 instances. Web服务端点正在使用具有3个实例的P3计划。 Amount of instances from 8+ doesn't make any change, so problem is somewhere else. 8个以上的实例数量没有任何变化,因此问题出在别的地方。 When I am checking live telemetry I can see there are 200 requests per seconds, and request duration is 200ms average which means web service is not bottle neck. 当我检查实时遥测时,可以看到每秒有200个请求,平均请求持续时间为200ms,这意味着Web服务不是瓶颈。

Database is P4 and DTU percentage is below 30% so that is not an issue as well. 数据库为P4,DTU百分比低于30%,因此这也不是问题。

One thing I found is that, when I run Console App from localhost computer I can finish operation in 50 seconds, in comparison to azure webjob which takes 1 minute. 我发现的一件事是,当我从本地计算机运行Console App时,与需要1分钟的天蓝色webjob相比,我可以在50秒内完成操作。 I tried to scale webjob to 4 or 8 instances with no luck. 我尝试将Webjob扩展到4或8个实例,但是没有运气。

What could I observe further to find out if I can finish this operation faster with Azure? 我可以进一步观察到什么,以确定我是否可以使用Azure更快地完成此操作?

I tried to scale webjob to 4 or 8 instances with no luck. 我尝试将Webjob扩展到4或8个实例,但是没有运气。

There are two types of WebJob. WebJob有两种类型。 Continuous and Triggered. 连续和触发。 Only Continuous WebJob can be scaled out and run on multi instances. 只能扩展Continuous WebJob并在多个实例上运行。 You could choose the WebJob type and Scale type when you creating the WebJob. 创建WebJob时,可以选择WebJob类型和Scale类型。

在此处输入图片说明

You also need to rewrite your code to suit the scaled WebJob. 您还需要重写代码以适应扩展的WebJob。 For example, if you want to insert 6000 rows to a table, you could insert 1500 rows by each job if the instance count is 4. 例如,如果要向表中插入6000行,则实例计数为4时,每个作业可以插入1500行。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM