-
Notifications
You must be signed in to change notification settings - Fork 441
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Understanding shared hosts for multiple functions in a function app #529
Comments
Multiple functions do reuse the same host, but that host can be scaled to multiple VMs (each potentially running several of the functions in the app). Hosts that are unused for 5 minutes get idled out. So having your timer be every 5 minutes puts you right on the Edge. In term of testing host reuse, you may want to try incrementing a static variable to tell apart new host vs reuse. This will be more reliable than clock time. I know I didn't address everything in your issue, and it may be better to open separate issues for unrelated things, like the code not running correctly. |
I should add that we are working on optimizing the cold start scenario. |
I'll respond quickly to a few of the points you brought up, but I agree with David that for any specific issues you should open separate bugs. Thanks for the feedback!
|
Being discussed in #298. |
Hi!
TL:DR;
The post got quite long so here is the gist :) Are multiple functions within a function app reusing the same host? I tried to keep the host warm using a time triggered small function, but it didn't help to improve the response time of another http triggered function within that function app.
/TL:DR;
First of all, I really like the promise of Azure Functions, I truly hope that they evolve and one day provide us with the opportunities to write truly serverless code.
I'm currently evaluating Azure Functions for API use cases (Where a function would fully replace a hosted API in a Web app or something similar) and wanted to explore the cold start issues. This is my setup:
The code can be found here
1 Function app that triggers http requests (Timer: 1 minute, trigger-function.js)
4 Function app that are http end points (Http Trigger, api-function.js)
All function apps are in isolated resource groups but in the same region, all are on the dynamic plan.
The idea of my test was to find out when an API end point is hit by the cold start issue. For that, the four http functions are called in different intervals: every 5 minutes, every 10, 15 and 30 minutes. You can read the full logs here*, but let's look at the relevant part:
As you can see, only the API that is repeatedly called every 5 minutes has a sane response time, every other endpoint has brutal response times above 3 seconds.
I then tried to put another time triggered function into the 30 minute API function app and have it be called repeatedly every 5 minutes. I thought that this would keep the host "warm" but it had no effect and the 30 minute API function still needed way too long to respond. Is each function hosted in its own host, even though they are part of the same function app?
*The logs are from the functions portal/web interface and seem to be missing a lot of invocations. I think that it should be mostly fine however, since the trigger function lists all API calls correctly.
Side remarks that I found during developing:
Keep up the good work! :)
The text was updated successfully, but these errors were encountered: