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

Add idle_timeout to routes API #603

Merged
merged 10 commits into from
Mar 25, 2017
Merged

Conversation

denismakogon
Copy link
Contributor

@denismakogon denismakogon commented Mar 22, 2017

Adding inactivity_timeout to routes API.
This change will allow users to define idle timeout for hot functions via API instead of having it hardcoded in worker.go.

Closes: #554

@denismakogon denismakogon self-assigned this Mar 22, 2017
Copy link
Contributor

@jmank88 jmank88 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@treeder
Copy link
Contributor

treeder commented Mar 22, 2017

Generally looks good, but can we call it IdleTimeout instead of InactivityTimeout ?

@denismakogon
Copy link
Contributor Author

@treeder Sure, why not.

Copy link
Contributor

@ucirello ucirello left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am 👎 this because I really think has not been thought through.

Now, instead of one timeouts, there are two. And one private constant, that most likely had a very good reason to be private, is now converted into a part of a public interface.

Also, lacking documentation about the use of this attribute and its impact in the behavior of the machinery - before, it has a predictable behavior, now, no one will actually know how it will behave.

@denismakogon denismakogon changed the title Add inactivity_timeout to routes API Add idle_timeout to routes API Mar 22, 2017
@denismakogon
Copy link
Contributor Author

denismakogon commented Mar 22, 2017

@ccirello So, yes, there are two timeouts, and it doesn't look like something bad or confusing. One timeout is for function call, and the idle timeout defines for how long to keep hot function around without serving requests for it. You're saying that it was not thought through, i tend to disagree on this, because it's not clear why hardcoded 30s timeout is exact timeout that every hot function should wait without processing requests before becoming "cold".
From user perspective, if i have a workload that comes each 1m, and i don't want to spend time to wait until function will be started (+ overhead of function itself, like pulling out data from 3rd party services, etc.) rather than setting idle timeout for 2m, so with such workload my hot function will be more effective in terms of faster requests serving.
Does it make sense?
cc @treeder @seiflotfy @pedronasser

@ucirello
Copy link
Contributor

@denismakogon - makes sense to a point.

So, yes, there are two timeouts, and it doesn't look like something bad or confusing.

Without context, I doubt people will know the difference between timeout and idle_timeout. This could be easily addressed with documentation though - as of now, however, docs are missing.

You're saying that it was not thought through, i tend to disagree on this, because it's not clear why hardcoded 30s timeout is exact timeout that every hot function should wait without processing requests before becoming "cold".

Indeed, it is not clear the reason behind 30s. However, whenever we change a constant to a variable, we are changing the behavior of the system. So what you are saying is that the user needs it - which I am fine with - and that this reason alone is enough to justify this change as it is right now.

I did not see anywhere any consideration of the consequences of this change: it does not define min and max boundaries, does not explain the consequence of too short or too long idle timeouts, it seems to address the zero case implicitly (for instance, it is not self-evident for me what happens if this idle_timeout is zero); also I do not see in the source code the interaction between this field being updated in the DB while the hot functions are still running.

Again, I am not against the goal of this change - but this implementation of this change is lacking in many aspects.

A middle-way here would be to merge this as it is, and open a batch of tickets addresses its deficiencies.

@denismakogon
Copy link
Contributor Author

@ccirello I agree on documentation as well as with edge cases. I'll make next PR with docs that explicitly describes all possible cases for idle time and its combinations with regular timeout.

@treeder
Copy link
Contributor

treeder commented Mar 24, 2017

The docs should be part of this PR, agree with @ccirello . Not complete without docs.

@denismakogon
Copy link
Contributor Author

@treeder doc is already here. Check last 2 commits.

@treeder
Copy link
Contributor

treeder commented Mar 24, 2017

@ccirello ok now with docs?

@ucirello
Copy link
Contributor

@denismakogon @treeder LGTM

@ucirello ucirello merged commit 7603e6e into iron-io:master Mar 25, 2017
martinpinto pushed a commit to martinpinto/functions that referenced this pull request Mar 29, 2017
* Add inactivity_timeout to routes API

Closes: iron-io#544

* Fix failing datastore tests

* Rename inactivity_timeout to idle_timeout

* Update swagger doc

* Update hot fn doc

* Fix json tags

* Add function timeouts docs

* Rewording
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants