portkey

Portkey: from REPL to Serverless in one call
stathissideris 2019-12-13T13:36:05.002200Z

hello, I was wondering about the Kryo mechanism: would it not be easier to target Lambda node.js and rely on the Cljs compiler (+Closure) to do all the packaging/tree shaking of cljs code (instead of clj)?

stathissideris 2019-12-13T13:43:40.002500Z

(and that would take care of the startup time as well)

cgrand 2019-12-13T14:37:46.008200Z

portkey goal was to experiment with a repl-driven workflow (think use cloud resources as a coprocessor for explorative programming, one-off tasks etc), not to deploy “poduction” lambdas. Without this requirement there’s no need for kryo. On JS VMs, there’s no way (unlike things have changed) to examine a closure (to get the closed over values), so no way to serailaze a live graph of objects. Advanced compilation + Closure gives you static treeshaking, while for this repl stuff it was dynamic tree shaking that was required. Graph of code modules vs graph of objects.

cgrand 2019-12-13T14:38:12.008600Z

Do you see what I mean?

viesti 2019-12-13T14:58:45.012100Z

in portkey, you would start tree-shaking from a function object at the repl, closing over whatever state you had in the repl

viesti 2019-12-13T15:02:50.016Z

Graal/native-image gives nice startup time and you can keep the synchronous programming model + Java ecosystem (to a degree that works nice with native-image)

viesti 2019-12-13T15:05:09.019300Z

for JavaScript, I think shadow-cljs is a nice option, since consuming npm libs works well and Closure compacts the JavaScript outputted by CLJS + minifies npm libs

viesti 2019-12-13T15:07:14.020900Z

the previous two options have both their merrits, but differ from the dynamism that portkey was experimenting with

stathissideris 2019-12-13T15:41:57.021600Z

@cgrand @viesti thanks for the insight, I hadn’t thought of the live aspect of it!

stathissideris 2019-12-13T15:42:53.022300Z

I’m considering experimenting with cljs+aws lambda+terraform for “production” lambdas

viesti 2019-12-13T15:45:45.023700Z

btw. Terraform has a nice way of creating Lambda zip file, and upload it if shasum changes

stathissideris 2019-12-13T15:47:05.024500Z

I am aware 🙂

👍 1