Running the simple hello world code below takes an average of 8 seconds to execute (200 samples, Minimum 64ms, max 14 seconds using jmeter).
I do not see app stops in the logs so why so long and why such a variance?
Note I've tried from multiple network connections, internal and external so doesn't appear network related.
public static class Function1
{
[FunctionName("Function1")]
public static async Task<IActionResult> Run(
[HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequest req,
ILogger log)
{
log.LogInformation("C# HTTP trigger function processed a request.");
string name = req.Query["name"];
string requestBody = await new StreamReader(req.Body).ReadToEndAsync();
dynamic data = JsonConvert.DeserializeObject(requestBody);
name = name ?? data?.name;
string responseMessage = string.IsNullOrEmpty(name)
? "This HTTP triggered function executed successfully. Pass a name in the query string or in the request body for a personalized response."
: $"Hello Universe, {name}. This HTTP triggered function executed successfully.";
return new OkObjectResult(responseMessage);
}
}
Log file doesn't show anything unusual:
2020-11-19T13:44:40.502 [Information] Executing 'Function1' (Reason='This function was programmatically called via the host APIs.', Id=47ae5039-ac8a-4146-8f06-76b74bafae42)
2020-11-19T13:44:40.540 [Information] Executing 'Function1' (Reason='This function was programmatically called via the host APIs.', Id=5e51999c-c255-44c8-b155-0ea5248d0621)
2020-11-19T13:44:40.541 [Information] Executing 'Function1' (Reason='This function was programmatically called via the host APIs.', Id=bcb087b3-2dae-4514-9821-34971d1e816e)
2020-11-19T13:44:40.541 [Information] Executing 'Function1' (Reason='This function was programmatically called via the host APIs.', Id=90ce4f95-8f34-4359-8bb6-d11b56198edd)
2020-11-19T13:44:40.547 [Information] C# HTTP trigger function processed a request.
2020-11-19T13:44:40.569 [Information] C# HTTP trigger function processed a request.
2020-11-19T13:44:40.570 [Information] Executing 'Function1' (Reason='This function was programmatically called via the host APIs.', Id=edd086c6-b5ad-43f1-855c-5dd729812e3a)
2020-11-19T13:44:40.570 [Information] C# HTTP trigger function processed a request.
2020-11-19T13:44:40.575 [Information] C# HTTP trigger function processed a request.
2020-11-19T13:44:40.622 [Information] Executed 'Function1' (Succeeded, Id=5e51999c-c255-44c8-b155-0ea5248d0621, Duration=76ms)
2020-11-19T13:44:40.699 [Information] C# HTTP trigger function processed a request.
2020-11-19T13:44:40.700 [Information] Executed 'Function1' (Succeeded, Id=edd086c6-b5ad-43f1-855c-5dd729812e3a, Duration=129ms)
2020-11-19T13:44:40.701 [Information] Executed 'Function1' (Succeeded, Id=bcb087b3-2dae-4514-9821-34971d1e816e, Duration=160ms)
2020-11-19T13:44:40.702 [Information] Executed 'Function1' (Succeeded, Id=90ce4f95-8f34-4359-8bb6-d11b56198edd, Duration=160ms)
2020-11-19T13:44:40.712 [Information] Executed 'Function1' (Succeeded, Id=47ae5039-ac8a-4146-8f06-76b74bafae42, Duration=230ms)