Skip to content
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

Proposal: Option for asynchronous invocations using cron-connector #1571

Closed
3 tasks done
noam09 opened this issue Sep 25, 2020 · 2 comments
Closed
3 tasks done

Proposal: Option for asynchronous invocations using cron-connector #1571

noam09 opened this issue Sep 25, 2020 · 2 comments

Comments

@noam09
Copy link

noam09 commented Sep 25, 2020

My actions before raising this issue

Expected Behaviour

Using cron-connector, users should have the option to deploy functions with an additional annotation, e.g. async (in addition to the current required annotations topic and schedule) which specifies whether the function should be invoked asynchronously.
Alternatively, users should have the option to deploy functions with a different topic annotation, e.g. cron-connector-async, which would yield the same result.

Current Behaviour

The cron-connector is very useful for scheduling invocation of functions which need to be executed at specific intervals.
Currently invocations are made using the /function/ path of the API Gateway, meaning they are invoked synchronously, hence the connector waits for an HTTP response for a while (write_timeout) before concluding whether the function was successful.
This is fine for short-running functions, but may be less adequate for long-running functions (e.g. 10 minutes). Of course timeouts can be increased, but this may leave some functions waiting for an HTTP response for over 10 minutes, and in some cases there may be several functions which need to be invoked simultaneously.

Possible Solution

Invoking functions asynchronously using the /async-function/ path may be a more fitting solution for long-running functions.
In terms of the effort required to implement something like this, checking an additional annotation and invoking the function using the appropriate path (async-function) shouldn't require significant modifications to the current cron-connector.
Also, the modifications could be made in a way that users of cron-connector who don't use or are not aware of an asynchronous annotation are not affected by it. The default behavior could be use of synchronous invocations, as they are currently.

Context

Longer running functions such as website scrapers may require several minutes to complete. When using the cron-connector, this means that the write_timeout has to be set rather high and sockets remain open awaiting HTTP responses until function completion.

@noam09
Copy link
Author

noam09 commented Oct 11, 2020

Hi @alexellis,
I just want to make sure this proposal isn't missing any required information. Thanks!

@alexellis
Copy link
Member

Hi @noam09,

Thank you for your interest in openfaas. Could you introduce yourself and who you're working for?

I'm also unclear why this issue wasn't raised on the cron-connector repository?

Bear with us as we have to triage and manage all user requests, and this is a fairly large project. Companies with a Premium Subscription get prioritisation.

@openfaas openfaas locked and limited conversation to collaborators Feb 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants