通过C#代码缩放天蓝色函数 [英] Scale azure function through C# code

查看:112
本文介绍了通过C#代码缩放天蓝色函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Azure Functions的新手.我需要编写一些C#代码,以根据某些条件扩展Azure函数.

I am new to Azure Functions.I need to write some C# code that scales out Azure Functions based on some condition.

例如:
我总共有10个将为其调用Azure Function的客户.但是在这10个客户中,只有一个高优先级客户.如果收到针对该高优先级客户的任何功能请求,我都希望扩展Azure功能并在新实例上运行该请求.该请求完成后,我想销毁该扩展实例.这样,我的高优先级客户就可以使用全部服务器资源.

For example:
I have total 10 customers for which Azure Function will be called. But out of these 10 there is one high priority customer. If any function request for that high priority customer comes in, I want scale out my Azure Function and run that request on a new instance. Once that request is completed, I want to destroy that scaled out instance. This way my high priority customer gets the full server resource to use.

我的问题是:

  1. 我想要什么吗?
  2. 如果是:
    怎么样?
    要扩展的C#代码应该是什么?
    如何将我的请求转发到新实例?
    如何销毁当前扩展实例?
  3. 如果否:
    在Azure Function中为选定的客户赋予高优先级的最佳方法应该是什么?
  1. Is it possible what I want?
  2. If yes:
    How?
    What should be the C# code to scale?
    How to forward my request to new instance?
    How can I destroy current scaled out instance?
  3. If No:
    What should be the best way to give high priority to selected customers in Azure Function?

推荐答案

这是不可能的.您不能直接影响"Azure Functions"的扩展算法(根据消费计划).

This is not possible. You can't directly affect the scaling algorithm of Azure Functions (on Consumption Plan).

Blob触发器特别具有一些已知限制,如文档.特别是,处理Blob可能会有所延迟.

Blob Trigger specifically has some known limitations as described in documentation. Particularly, there are might be delays in processing blob.

为了更快地扩展,我建议您使用事件网格触发器,这对于您的优先"和非优先"客户都应该很好地扩展.请参见图像大小调整示例.

For faster scaling, I suggest you using Event Grid triggers, which should scale pretty well for both "priority" and "non-priority" customers of yours. See Image Resizing sample.

这篇关于通过C#代码缩放天蓝色函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆