Commit Graph

467 Commits

Author SHA1 Message Date
Travis Reeder
7a81aa5761 Merge branch 'middleware-update' into 'master'
Allow setting values in middleware context like gin context.

See merge request !99
2017-07-12 15:05:13 -07:00
Reed Allman
8d669c202c Merge branch 'one-db' into 'master'
merge datastores into sqlx package

See merge request !101
2017-07-11 11:30:41 -07:00
Travis Reeder
0f83355f0a Merge branch 'fix-root-route-invocation' into 'master'
Allow calling root route on app

Closes #64

See merge request !91
2017-07-11 09:44:29 -07:00
Travis Reeder
bd9c9c5202 WIP, setting values in middleware context like gin context. 2017-07-07 16:34:04 -07:00
James Jeffrey
81e39b210d Add go fmt 2017-07-07 10:14:08 -07:00
Reed Allman
4e52c595d2 merge datastores into sqlx package
replace default bolt option with sqlite3 option. the story here is that we
just need a working out of the box solution, and sqlite3 is just fine for that
(actually, likely better than bolt).

with sqlite3 supplanting bolt, we mostly have sql databases. so remove redis
and then we just have one package that has a `sql` implementation of the
`models.Datastore` and lean on sqlx to do query rewriting. this does mean
queries have to be formed a certain way and likely have to be ANSI-SQL (no
special features) but we weren't using them anyway and our base api is
basically done and we can easily extend this api as needed to only implement
certain methods in certain backends if we need to get cute.

* remove bolt & redis datastores (can still use as mqs)
* make sql queries work on all 3 (maybe?)
* remove bolt log store and use sqlite3
* shove the FnLog shit into the datastore shit for now (free pg/mysql logs...
just for demos, etc, not prod)
* fix up the docs to remove bolt references
* add sqlite3, sqlx dep
* fix up tests & mock stuff, make validator less insane
* remove put & get in datastore layer as nobody is using.

this passes tests which at least seem like they test all the different
backends. if we trust our tests then this seems to work great. (tests `make
docker-test-run-with-*` work now too)
2017-07-07 01:30:02 -07:00
Reed Allman
e9294c594e Merge branch 'resolves_issue_37' into 'master'
Resolves issue 37

Closes #37

See merge request !88
2017-07-06 14:10:31 -07:00
James Jeffrey
55239dbd80 Check both errors 2017-07-06 12:42:09 -07:00
James Jeffrey
7ebf8ab144 No nil errors on error 2017-07-06 12:23:44 -07:00
Reed Allman
c0466bd0cd Merge branch 'hot-lambda' into 'master'
Hot lambda

Closes #81

See merge request !90
2017-07-06 12:22:43 -07:00
James Jeffrey
61bd41f9b2 Error apps create not route 2017-07-06 12:22:03 -07:00
James Jeffrey
e5b1bb03ea Address more comments. Add docs and clean up comments 2017-07-06 12:19:48 -07:00
James Jeffrey
d3fb420be0 Move logging. Remove todo comment 2017-07-06 12:08:17 -07:00
James Jeffrey
77c5d38381 Update docs 2017-07-06 11:46:25 -07:00
James Jeffrey
021bb32a22 Refactor tests to use testRoute case struct. Use one method for tests. Fix logic for when to skipzero 2017-07-06 11:46:25 -07:00
James Jeffrey
a37abfd9d5 Add error validation to some cases that were missing it. 2017-07-06 11:46:25 -07:00
James Jeffrey
3087a12b83 Needs != for this. Do not try to test client for functions go if there 2017-07-06 11:46:25 -07:00
James Jeffrey
7f226bc96b Assign err. Fixes tests that were not working 2017-07-06 11:46:25 -07:00
James Jeffrey
b4d39c0f3c Refactor seperate out logic 2017-07-06 11:46:24 -07:00
James Jeffrey
4845ddb1d4 Only use 200 follows what others do. Less switching. Remove defense 2017-07-06 11:46:24 -07:00
James Jeffrey
c66a0d0cc4 Update swagger doc. Indicate to user if updated or created 2017-07-06 11:46:24 -07:00
James Jeffrey
70eb25c873 Change logic behind put post and patch for routes 2017-07-06 11:46:24 -07:00
Will Price
02d6349cf8 Allow calling root route on app
Fixes #64

Previously calling a root registered route would result in an error
message "Not Found" suggesting the route hadn't been registed, yet when
listing the routes, `fn routes list myapp` you could see the `/` route.

You can now successfully call a root registered route with `fn call
myapp /`
2017-07-06 10:40:34 +01:00
Travis Reeder
5ec0eadff8 Got optional hot functions working for Lambda. 2017-07-05 23:34:19 -07:00
Reed Allman
db782536d9 Merge branch 'fix_issue_72' into 'master'
This returns 404 when app is not there on delete closes #72

Closes #72

See merge request !87
2017-06-30 12:37:58 -07:00
James Jeffrey
8e97a635a9 This returns 404 when app is not there on delete closes #72 2017-06-30 12:20:59 -07:00
Denis Makogon
67719d691d Check if route exist before attempting to delete it
xFixes: #76
2017-06-30 14:09:00 +03:00
Travis Reeder
1f3218f8dd WIP: working on hot lambda functions. 2017-06-29 08:00:29 -07:00
Travis Reeder
ad11f0699a Merge branch 'pass-call-id' into 'master'
Pass call ID into function, closes #79

Closes #79

See merge request !78
2017-06-23 12:12:25 -07:00
Travis Reeder
ce3245e243 Pass call ID into function, closes #79 2017-06-22 09:54:59 -07:00
Denis Makogon
c80746bf56 Add app and route validation to calls API handler
This patch adds check for app and route to ensure
 that they exist before listing calls
2017-06-22 18:23:31 +03:00
Travis Reeder
8800ecc5c2 Merge branch 'func_logs2' into 'master'
Func logs feature

See merge request !66
2017-06-20 11:51:26 -07:00
Travis Reeder
8c96d3ba2f Fixes async payload passing for #68. 2017-06-20 11:32:51 -07:00
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
Travis Reeder
9a8ff408b5 Fixes scary output on docker startup. 2017-06-15 15:48:34 -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
636af2f7ea fix up the tests 2017-06-06 05:04:22 -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
Denis Makogon
31b4ac4516 Address broken tests 2017-05-30 08:50:53 -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
James Jeffrey
ceaf497957 Merge branch 'chad-ux-improvements' into 'master'
Chad ux improvements

See merge request !20
2017-05-27 00:26:00 +00:00
Chad Arimura
1e90fc4459 consts 2017-05-26 17:01:39 -07:00
Travis Reeder
69f0201818 Some small cleanup to docs. 2017-05-26 18:54:26 +00:00
Chad Arimura
8899361545 adding ascii art to server start 2017-05-25 09:39:14 -07:00
Travis Reeder
961d17bdb8 Uses SetDefaults as it does in create too. 2017-05-18 14:18:16 -07:00