简体   繁体   English

使用 .NET Fluent API 扩展 Azure 弹性池

[英]Scaling an Azure Elastic Pool with .NET Fluent API

I'm using the Azure Fluent API, Azure Management Libraries for .NET , to scale the DTU's within an Azure Elastic Pool and would like to know if it's possible to trigger an update without having to wait for the processing to complete.我正在使用 Azure Fluent API(用于 .NET 的 Azure 管理库)在 Azure 弹性池中扩展 DTU,我想知道是否可以触发更新而无需等待处理完成。

Currently the following block of code will wait until the Elastic Pool has finished scaling before it continues execution.目前,以下代码块将等待弹性池完成扩展,然后再继续执行。 With a large premium Elastic Pool this could mean that the this line will take up to 90 minutes to complete.使用大型优质弹性池,这可能意味着该生产线最多需要 90 分钟才能完成。

ElasticPool .Update() .WithDtu(1000) .Apply();

There's also a ApplyAsync() method which i could deliberately not await to allow the program to continue execution, if i take this approach the program will end execution shortly after calling this line and i am unsure if this library has been designed to work in this fashion.还有一个ApplyAsync()方法,我可以故意不await以允许程序继续执行,如果我采用这种方法,程序将在调用此行后不久结束执行,我不确定该库是否已设计用于此时尚。

Does anyone know of a better solution to trigger an update without having to wait on a response?有谁知道触发更新而无需等待响应的更好解决方案? Or if it is safe to fire the async method without waiting for a response?或者如果不等待响应就可以安全地触发异步方法?

There is currently no way to make a fire and forget calls in the Fluent SDK for update scenarios but we are looking to the ways of enabling a manual status polling in the future.目前还没有办法在 Fluent SDK 中针对更新场景触发和忘记调用,但我们正在寻找在未来启用手动状态轮询的方法。 One option would be to create a thread that will wait on the completion.一种选择是创建一个等待完成的线程。 The other one is to use the Inner getter and make a low level BeginCreateOrUpdateAsync/BeginUpdateAsync method calls and then do manual polls.另一种是使用内部 getter 并进行低级别的 BeginCreateOrUpdateAsync/BeginUpdateAsync 方法调用,然后进行手动轮询。

On the side note if you need to make multiple calls and then wait for completion of all of them you can use Task.WaitAll(...) and provide the list of the ApplyAsync tasks.另外,如果您需要进行多次调用,然后等待所有调用完成,您可以使用 Task.WaitAll(...) 并提供 ApplyAsync 任务的列表。

Please log an issue in the repo if you will hit any errors because that way you will be able to track the progress of the fix.如果您遇到任何错误,请在repo 中记录问题,因为这样您将能够跟踪修复的进度。

edit: FYI the call is blocking not because SDK is waiting for the response from Azure but that SDK waits until the call is completed, operation of update is finished and the resource is ready to be used for further operations.编辑:仅供参考,调用阻塞不是因为 SDK 正在等待来自 Azure 的响应,而是 SDK 等待调用完成、更新操作完成并且资源准备好用于进一步操作。 Just firing an update and then trying to use resource will cause error responses if in your case Elastic Pool is still in the middle of the update.如果在您的情况下 Elastic Pool 仍在更新中,则仅触发更新然后尝试使用资源将导致错误响应。

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

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