Azure Functions延迟 [英] Azure Functions latencies

查看:54
本文介绍了Azure Functions延迟的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好!
$


我目前正面临Azure功能呼叫的问题。



当我第一次调用AF(长时间不使用)后,它几乎立即开始执行代码。但是如果我在完成后的几秒钟内调用相同的函数,则需要10-15秒,在它开始的那一刻和它执行代码的时刻之间
。 (每次重复操作时,结果保持不变:1次调用 - 非常快,所有其他调用:延迟)。

Hello !

I am currently facing an issue with Azure Function calls.

When I call the AF for the first time (after long time of no use), it starts the execution of the code almost instantanelly. But if I call the same function a few seconds after it has finished, it takes 10-15sec, between the moment it starts and the moments it executes the code. (Each time I repeat the operation the result stay the same : 1 call - very quick, all other calls : latencies).

[FunctionName("GetUserDestinationsList")]
public static async Task<HttpResponseMessage> Run([HttpTrigger(Settings.DefaultAuthorization, "get", Route = null)]HttpRequestMessage req, TraceWriter log)
{
    try
    {
        log.Info($"Start Execute function");
        var allDestinations = await DestinationsFactory.GetAllDestinations();
        IEnumerable<KeyValuePair<string, string>> values = req.GetQueryNameValuePairs();
        ...
}




我记录代码执行的开始。

这里通话结果:



- 功能首次拨打:



2018-11-22 08 :24:30.517 - 功能开始(Id = c86f9b71-03ed -...)
$


2018-11-22 08:24:30.955 - 启动执行功能



2018-11-22 08:24:39.600 - 功能完成(成功,Id = c86f9b71-03ed -...,持续时间= 9062ms)



- 二次通话:



2018-11-22 08:24:44.482 - 功能开始(Id = 12eb3f0e-a180- ...)



2018-11-22 08:24:53.489 - 开始执行功能



2018-11-22 08:24:58.534 - 功能完成(成功,Id = 12eb3f0e-a180 -...,持续时间= 14047ms)



- 三次通话:  
$


2018-11-22 08:25:04.479 - 功能开始(Id = 30784cc2-d2de -...)



2018-11-22 08:25:17.985 - 开始执行功能



2018-11-22 08:25:22 .856 - 功能完成(成功,Id = 30784cc2-d2de -...,持续时间= 18381ms)



如您所见,第二次有一些延迟第三次通话。



三次通话采用相同的参数并在结束时返回相同的结果,只有开始时间或多或少的时间。



我也可以在本地重现这个问题。



任何想法?



谢谢。


I log the start of the code execution.
Here the result of the calls :

- First Call of the Function :

2018-11-22 08:24:30.517 - Function started (Id=c86f9b71-03ed-...)

2018-11-22 08:24:30.955 - Start Execute function

2018-11-22 08:24:39.600 - Function completed (Success, Id=c86f9b71-03ed-..., Duration=9062ms)

- Second Call :

2018-11-22 08:24:44.482 - Function started (Id=12eb3f0e-a180-...)

2018-11-22 08:24:53.489 - Start Execute function

2018-11-22 08:24:58.534 - Function completed (Success, Id=12eb3f0e-a180-..., Duration=14047ms)

- Third Call : 

2018-11-22 08:25:04.479 - Function started (Id=30784cc2-d2de-...)

2018-11-22 08:25:17.985 - Start Execute function

2018-11-22 08:25:22.856 - Function completed (Success, Id=30784cc2-d2de-..., Duration=18381ms)

As you can see, there is some latencies on the second and third call.

Three calls takes sames parameters and return the same result at the end, only the begining takes more or less time.

I can also reproduce this problem locally.

Any idea ?

Thanks.

推荐答案

如果我在每次通话之间等待大约20秒,则不再有延迟。它们似乎只在呼叫彼此接近时发生。


这篇关于Azure Functions延迟的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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