【发布时间】:2020-12-02 14:35:33
【问题描述】:
我有一个使用此 host.json 配置运行的 Azure 函数:
{
"version": "2.0",
"extensions": {
"http": {
"routePrefix": "api",
"maxOutstandingRequests": 200,
"maxConcurrentRequests": 2,
"dynamicThrottlesEnabled": false
}
}
}
但是,当这个函数应用运行时,我可以看到有超过 2 个请求同时运行:
private static int concurrency;
[FunctionName(nameof(Page))]
private async Task<IActionResult> Page(string arg)
{
var n = Interlocked.Increment(ref concurrency);
try
{
this.log.Debug(n);
// The code
}
finally
{
Interlocked.Decrement(ref n);
}
}
当我提高对函数的调用率时,我会记录 n 值超过 20 的日志条目,而我希望永远不会看到超过 2 的值,如果此设置值得到遵守,并且我已经理解它是正确的。
【问题讨论】:
标签: azure-functions azure-function-app azure-functions-runtime