Azure / Azure/azure-functions-host
Cold start time took more more than 10 secs with C# compiled + "Run from package" for Azure function v2
- Dominant language
- C#
- Stars
- 2k
- Forks
- 482
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 37
Description
#### Investigative information
Please provide the following:
- Timestamp: 2019-01-16 01:01:11.130
- Function App version (1.0 or 2.0): 2
- Function App name: test-vs-func
- Function name(s) (as appropriate): test_vs_func
- Invocation ID: 24594d05-f1bb-4840-8439-f0227fb02678
- Region: East Asia
#### Repro steps
Provide the steps required to reproduce the problem:
1. Compiled the sample app with visual studio for mac.
2. Change function app to "Run from package"
3. Zip it and do the zip deployment.
`az functionapp deployment source config-zip -g rudy-dev -n test-vs-func --src csharp.zip`
#### Expected behavior
I would expect that C# compiled + "Run from package" would have the lowest cold start time.
#### Actual behavior
The cold start time is even worse than C# without "Run from package" and C# script.
#### Known workarounds
no
#### Related information
Provide any related information
* Programming language used C#
* Bindings used: none
* I can provide the package I uploaded if that helps,
https://drive.google.com/file/d/1FzEm9QLNeOj5eJlv_U64kuRpw-nIOb8f/view?usp=sharing
Source
```csharp
using System;
using System.IO;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.AspNetCore.Http;
using Microsoft.Azure.WebJobs.Host;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
namespace test_vs_func
{
public static class test_vs_func
{
[FunctionName("test_vs_func")]
public static async Task 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;
return name != null
? (ActionResult)new OkObjectResult($"Hello, {name}")
: new BadRequestObjectResult("Please pass a name on the query string or in the request body");
}
}
}
```
Contributor guide
Research direction
Start with the provided C# sample and reproduce the deployment using `az functionapp deployment source config-zip` for Function App v2 in East Asia. Compare cold-start behavior for compiled C# with and without "Run from package"; done means the discrepancy is explained and the reported deployment path behaves as documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, csharp
- Domain
- backend, cloud
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100