Commit Graph

73 Commits

Author SHA1 Message Date
James
8a3edb8309 All of the changes for func logs 2017-06-19 11:38:11 -07:00
Reed Allman
161459192d Id gen suga 2017-06-19 10:40:26 -07:00
Reed Allman
75c5e83936 adds wait time based scaling across nodes
this works by having every request from the functions server kick back a
FXLB-WAIT header on every request with the wait time for that function to
start. the lb then keeps track on a per node+function basis an ewma of the
last 10 request's wait times (to reduce jitter).  now that we don't have max
concurrency it's actually pretty challenging to get the wait time stuff to
tick. i expect in the near future we will be throttling functions on a given
node in order to induce this, but that is for another day as that code needs a
lot of reworking. i tested this by introducing some arbitrary throttling (not
checked in) and load spreads over nodes correctly (see images). we will also
need to play with the intervals we want to use, as if you have a func with
50ms run time then basically 10 of those will rev up another node (this was
before removing max_c, with max_c=1) but in any event this wires in the basic
plumbing.

* make docs great again. renamed lb dir to fnlb
* added wait time to dashboard
* wires in a ready channel to await the first pull for hot images to count in
the wait time (should be otherwise useful)

future:
TODO rework lb code api to be pluggable + wire in data store
TODO toss out first data point containing pull to not jump onto another node
immediately (maybe this is actually a good thing?)
2017-06-09 16:30:34 -07:00
Reed Allman
9edacae928 clean up hotf(x) concurrency, rm max c
this patch gets rid of max concurrency for functions altogether, as discussed,
since it will be challenging to support across functions nodes. as a result of
doing so, the previous version of functions would fall over when offered 1000
functions, so there was some work needed in order to push this through.
further work is necessary as docker basically falls over when trying to start
enough containers at the same time, and with this patch essentially every
function can scale infinitely. it seems like we could add some kind of
adaptive restrictions based on task run length and configured wait time so
that fast running functions will line up to run in a hot container instead of
them all creating new hot containers.

this patch takes a first cut at whacking out some of the insanity that was the
previous concurrency model, which was problematic in that it limited
concurrency significantly across all functions since every task went through
the same unbuffered channel, which could create blocking issues for all
functions if the channel is not picked off fast enough (it's not apparent that
this was impossible in the previous implementation). in any event, each
request has a goroutine already, there's no reason not to use it. not too hard
to wrap a map in a lock, not sure what the benefits were (added insanity?) in effect
this is marginally easier to understand and less insane (marginally). after
getting rid of max c this adds a blocking mechanism for the first invocation
of any function so that all other hot functions will wait on the first one to
finish to avoid a herd issue (was making docker die...) -- this could be
slightly improved, but works in a pinch. reduced some memory usage by having
redundant maps of htfnsvr's and task.Requests (by a factor of 2!). cleaned up
some of the protocol stuff, need to clean this up further. anyway, it's a
first cut. have another patch that rewrites all of it but was getting into
rabbit hole territory, would be happy to oblige if anybody else has problems
understanding this rat's nest of channels. there is a good bit of work left to
make this prod ready (regardless of removing max c).

a warning that this will break the db schemas, didn't put the effort in to add
migration stuff since this isn't deployed anywhere in prod...

TODO need to clean out the htfnmgr bucket with LRU
TODO need to clean up runner interface
TODO need to unify the task running paths across protocols
TODO need to move the ram checking stuff into worker for noted reasons
TODO need better elasticity of hot f(x) containers
2017-06-05 20:04:13 -07:00
Denis Makogon
3f065ce6bf [Feature] Function status 2017-06-06 14:12:50 -07:00
James Jeffrey
c7a5bae587 Merge branch 'chad-gitlab-url-change' into 'master'
Chad gitlab url change

See merge request !28
2017-05-30 11:34:22 -07:00
Travis Reeder
af918fdfe9 Fix run env vars passed in via command line to test locally and updated docs to match. 2017-05-30 10:54:34 -07:00
Chad Arimura
49d397293b global url replace 2017-05-29 17:10:47 -07:00
Travis Reeder
9ba22989f8 functions: 0.3.4 release [skip ci] 2017-05-27 09:41:11 -07:00
Travis Reeder
69f0201818 Some small cleanup to docs. 2017-05-26 18:54:26 +00:00
James
e4bb04887e Rewrite imports to use forks files on gitlab not use githubs. 2017-05-16 11:06:32 -07:00
Travis Reeder
4b9bba352d Rename location. 2017-05-15 11:00:15 -07:00
Travis Reeder
d0ca2f9228 Moved runner into this repo, update dep files and now builds. 2017-04-21 07:42:42 -07:00
Travis Reeder
615ae5c36f Mass s&r: iron-io -> kumokit 2017-04-19 09:49:12 -06:00
Denis Makogon
7603e6e8fa Add idle_timeout to routes API (#603)
* Add inactivity_timeout to routes API

Closes: #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
2017-03-25 18:28:53 +01:00
Denis Makogon
6a8b995e04 Fix REQUEST_URL to reflect host and port of a client (#580)
Fixes: #578
2017-03-14 13:55:56 -07:00
Goutham Veeramachaneni
fae66764b4 Config EnvVars passed without leading _ (#534)
* Earlier X=Y was passed as _X=Y

Signed-off-by: Goutham Veeramachaneni <cs14btech11014@iith.ac.in>
2017-03-03 16:17:00 -08:00
Seif Lotfy سيف لطفي
e39f70d6cc Return 500 if trying to run path with non-existing image (#546)
* Return 500 if trying to run path with non-existing image

Fixes: #540

* Add failed task run to logs
2017-02-28 19:14:51 -06:00
Pedro Nasser
a5eeacdadb fix runner response (#517) 2017-02-11 03:36:56 +01:00
Seif Lotfy سيف لطفي
ab9428a937 Unskip tests (#516)
* Unskip tests

* fix fn output for errors

* Change Error model and add fn routes call return on error
2017-02-09 22:31:39 -02:00
Seif Lotfy سيف لطفي
6f8e94629f server: Add global LRU for routes with keys being the appname + path (#472)
* Add global lru for routes with keys being the appname + path

* minor comment fixes

* remove duplicate entires from THIRD_PARTY

* Make sure that we lock and unlock on get, refresh and delete on the cache
2017-01-05 19:08:46 +01:00
Travis Reeder
1c8d12b09e Cleanup main (#470)
* main: clean up

* server: replace magical constants and use them for app name tracking
2017-01-03 14:59:26 -08:00
C Cirello
c48bd95fa6 server: stats endpoint (#468)
fixes #389
2017-01-03 21:39:29 +01:00
Pedro Nasser
63c2b18ac5 remove gin, fix specialhandler and added test (#448) 2016-12-15 10:26:59 -08:00
Pedro Nasser
4d7dde3486 change update from PUT method to PATCH (#440) 2016-12-14 17:22:44 +01:00
Pedro Nasser
2a09a1c2a2 listeners and special handlers improvements (#412)
* listeners and special handlers improvements

* update runnerListener methods

* typo
2016-12-13 19:40:48 +01:00
Pedro Nasser
49a7712e6b API improvements (#410)
* api improvements, remove global Api object and reduce gin dependency

* requested changes
2016-12-09 15:24:35 -02:00
C Cirello
d6a44b5ba4 functions: remove lru (#399) 2016-12-07 00:20:25 +01:00
C Cirello
a7a466f968 functions: fix route timeout (#349)
* functions: add route-level timeout configuration options

* functions: harmonize defaults
2016-11-28 20:53:11 -02:00
C Cirello
ac0044f7d9 functions: hot containers (#332)
* functions: modify datastore to accomodate hot containers support

* functions: protocol between functions and hot containers

* functions: add hot containers clockwork

* fn: add hot containers support
2016-11-28 15:45:35 -02:00
Pedro Nasser
867eb4b176 Changes on function/metric loggers (#343)
* initial fix logger

* dix DefaultFuncLogger

* fix runner and tests

* reverting: sending async task stdout to func logger
2016-11-27 16:36:40 -02:00
Pedro Nasser
c14bc323f9 added ctx to datastore and improve mock (#329)
Added ctx to datastore and improved mock
2016-11-22 03:33:44 -02:00
C Cirello
f6d19c3cc9 functions: performance improvements - LRU & singleflight DB calls (#322)
* functions: add cache and singleflight to ease database load

* runner: upgrade

* deps: upgrade glide files

* license: add third party notifications

* functions: fix handling of implicitly created apps

* functions: code deduplication

* functions: fix missing variable
2016-11-21 19:48:11 +01:00
Pedro Nasser
0343c4990c server.New signature changes and test fixes. (#324)
* ctx middleware should always be the first added to router

* plugable enqueue func, changed server.New signature

* fix tests

* remove ctx/ctx.Done from server
2016-11-21 17:11:01 +01:00
C Cirello
9d06b6e687 functions: common concurrency stream for sync and async (#314)
* functions: add bounded concurrency

* functions: plug runners to sync and async interfaces

* functions: update documentation about the new env var

* functions: fix test flakiness

* functions: the runner is self-regulated, no need to set a number of runners

* functions: push the execution to the background on incoming requests

* functions: ensure async tasks are always on

* functions: add prioritization to tasks consumption

Ensure that Sync tasks are consumed before Async tasks. Also, fixes
termination races problems for free.

* functions: remove stale comments

* functions: improve mem availability calculation

* functions: parallel run for async tasks

* functions: check for memory availability before pulling async task

* functions: comment about rnr.hasAvailableMemory and sync.Cond

* functions: implement memory check for async runners using Cond vars

* functions: code grooming

- remove unnecessary goroutines
- fix stale docs
- reorganize import group

* Revert "functions: implement memory check for async runners using Cond vars"

This reverts commit 922e64032201a177c03ce6a46240925e3d35430d.

* Revert "functions: comment about rnr.hasAvailableMemory and sync.Cond"

This reverts commit 49ad7d52d341f12da9603b1a1df9d145871f0e0a.

* functions: set a minimum memory availability for sync

* functions: simplify the implementation by removing the priority queue

* functions: code grooming

- code deduplication
- review waitgroups Waits
2016-11-18 18:23:26 +01:00
C Cirello
02d3b18497 all: drop CONFIG_ prefix for configuration (#297)
Fixes #251
2016-11-15 19:19:21 +01:00
Carlos C
d5fb1afda7 Revert "Assert License (#224)"
This reverts commit a61c4dab78.
2016-11-06 09:25:12 -08:00
C Cirello
a61c4dab78 Assert License (#224)
* license: assert license for Go code
* license: add in shell scripts
* license: assert license for Ruby code
* license: assert license to individual cases
* license: assert license to Dockerfile
2016-11-05 23:33:07 +01:00
C Cirello
1025caeb04 fnctl: add run command and fix env var handling (#211)
* fnctl: add run command and fix env var handling
* fnctl: fix help screens
* fnctl: address code review and fix logic mistake
2016-11-03 16:37:29 +01:00
C Cirello
42efb2ed6b Improve routes query (#172) 2016-10-14 21:52:25 +02:00
Travis Reeder
75383d060f Updated route_name in json to app_name. 2016-10-13 20:24:06 -07:00
Travis Reeder
25f582b180 Updated README and simplified/cleaned up some code. 2016-10-13 20:24:06 -07:00
Pedro Nasser
2e12e2c700 Fix input async tasks + tests (#137) 2016-10-12 22:23:34 +02:00
Seif Lotfy سيف لطفي
064d597b60 Fix runner changes (#135)
* Upgrade iron-io/runner to 165c16a9

* fix support for Stdin to work
2016-10-07 21:17:40 +02:00
Seif Lotfy سيف لطفي
52cab30056 Change PAYLOAD input to STDIN (#111)
* change to iron-io/runner dependency
* Fix runner dependency
* Change PAYLOAD input to STDIN, fixes #40
2016-10-06 18:44:58 -03:00
C Cirello
3ca137a01c Upgrade to Go 1.7 (#128)
* Upgrade to stdlib context package
* Modernized syntax
2016-10-06 20:10:00 +02:00
Seif Lotfy سيف لطفي
fbcec6bf40 Depend on iron-io/runner instead of iron-io/worker (#124) 2016-10-05 20:42:12 +02:00
Seif Lotfy
a8535120da async calls return the call_id/task_id 2016-10-02 22:38:51 +02:00
Seif Lotfy
92df53b144 Add support for Async worker 2016-09-24 10:06:57 +02:00
Seif Lotfy
b623fc27e4 Initial work on async functions 2016-09-24 10:06:51 +02:00