portkey

Portkey: from REPL to Serverless in one call
cgrand 2017-07-13T21:03:18.032865Z

Hi Daniel!

cgrand 2017-07-13T21:06:27.127431Z

@spieden As you may have noticed portkey is very very young. We share the goal of “transparent local dev -> serverless deployment”

spieden 2017-07-13T21:07:17.151829Z

i’d been holding back on figuring out much of what you guys have well in progress

cgrand 2017-07-13T21:07:21.153666Z

startup latency: we haven’t worked on it so it’s the usual sluggish startup

spieden 2017-07-13T21:07:40.162941Z

for my use case it really doesn’t matter, as step functions state machines are long running

spieden 2017-07-13T21:09:30.216033Z

i’ll try to get some experimenting in soon =)

cgrand 2017-07-13T21:09:41.220957Z

we have a tree-shaker, for now it doesn’t cover clojure.jar, but with time, love and care it could be robust enough to remove unneeded stuff from clojure and yields fastest startups

cgrand 2017-07-13T21:10:34.246478Z

if you wat to experiment you’ll have to dig in the code to use deploy! rather than mount (which has api gateway stuff)

spieden 2017-07-13T21:11:44.279964Z

ok cool

spieden 2017-07-13T21:12:17.295497Z

so the tree shaking only covers the clojure code i’m guessing — are all bytecode jars on the classpath included?

cgrand 2017-07-13T21:14:53.367065Z

basically kryo and clojure are left untouched (plus a couple of classes and namespaces), everything else is shaken

cgrand 2017-07-13T21:16:01.398301Z

@viesti loves to tree-shake hadoop parts

cgrand 2017-07-13T21:17:02.427017Z

Currently the tree-shaker has a bug on genclassed classes

spieden 2017-07-13T21:19:39.498258Z

hadn’t encountered kryo before. only JVM slimming i have previous experience with is a little ProGuard

viesti 2017-07-13T21:22:08.565244Z

so have been tossing at @cgrand this puzzle of a parquet->avro conversion which shrinks from 90MB jar to 5MB, but as said, there are some things to cover still :)

viesti 2017-07-13T21:27:04.695579Z

loading resources/classes based on runtime information is the basic dilemma, more actual use of portkey would help to see what is most important to cover

spieden 2017-07-13T21:30:41.791372Z

hmm yeah

spieden 2017-07-13T21:30:50.795709Z

so code’s being run out of these kryo files vs .class files?

cgrand 2017-07-13T21:33:14.859476Z

Compared to ProGuard which shake classes, we shake an object graph rooted at the closure we want to deploy to Lambda

cgrand 2017-07-13T21:33:32.867193Z

so we have to send two things: classes and actual instances

spieden 2017-07-13T21:33:39.870308Z

hmm, your portkey.core/as-doto* is very similar to our bean-dip lib except w/ reflection =) https://github.com/uwcpdx/bean-dip/

spieden 2017-07-13T21:33:41.871326Z

oh i see

spieden 2017-07-13T21:34:32.894613Z

yeah vars are objects

spieden 2017-07-14T18:14:29.025505Z

wow cool. except i suppose for stateful things like database connections, etc.

cgrand 2017-07-14T20:37:41.133841Z

Indeed IO channels don't serialize well.

cgrand 2017-07-13T21:34:32.894693Z

so kryo is used to serialize instances

cgrand 2017-07-13T21:36:09.940292Z

starting from a live graph of objects gives us an edge over ProGuard (especially when it comes to clojure code) as we have more information

cgrand 2017-07-13T21:43:03.124251Z

spieden: it’s only called during macroexpansion and that’s true than we could certainly get away without reflection at all

spieden 2017-07-13T21:46:01.196958Z

ah i see. i didn’t think of that approach for some reason — just went purely on naming convention and let *warn-on-reflection* catch missing methods

spieden 2017-07-13T21:47:33.233980Z

simpler implementation but same perf i guess

spieden 2017-07-13T21:48:11.249249Z

not much room for smarts in my soln though