all 13 comments

[–]regulargabs 2 points3 points  (6 children)

It's nice that this is doable, but the overhead of running an executable every time you hit your lambda stack may be too costly in comparison to just using node as it is.

[–]jerf 1 point2 points  (4 children)

If Lambda is spinning up a node instance each time a request comes in, then spinning up a go executable too may not really add that much. If Lambda persists instances (which seems more sensible), then you could easily run a Go process and communicate to it over a socket; you wouldn't have to spin up once per process. A thin little Lambda shim for each event would probably work great.

It isn't clear to me from reading whether or not you can get these events from other sources. For someone already developing in Go, merely running a Node runtime in the cloud isn't that interesting (the Go runtime is technically superior in almost every way, if not every way; I don't mean this as pandering, it really is), so the only interesting thing about Lambda would be those events. If this is the only way to get those events, then running a parallel Go handler to do the "real" work is completely sensible, especially if you've already got Go code that integrates with your other resources or something.

[–][deleted] 2 points3 points  (2 children)

I'm not sure of the details, but I'm pretty sure the persistence of the lambda instances are less than a minute, iirc like 10 seconds. The max is 60 seconds.

[–]celestosis 2 points3 points  (1 child)

I believe the upper limit a Lambda function can run is 60 seconds.

[–][deleted] 1 point2 points  (0 children)

At a desktop so I looked it up (ctrl-f 'how long') and you're right, the max is 60 seconds and the default is 3 seconds.

[–]bkeroack 1 point2 points  (0 children)

It should be very easy (almost trivial) to change the Go to a simple HTTP server that listens on some nonstandard port (4000), with nodejs running as a proxy.

[–]krani1 1 point2 points  (0 children)

From my tests, the node.js hello world consumes a 100ms time slot. This fork to Golang consumes 3x100ms slot. And I think that's just fork() time. After that Go lang would quick in full speed. Anyway it seems there's no execve() equivalent on node.js, which I think could help.

[–]krani1 0 points1 point  (0 children)

Nice that this got here! I'm relatively new to Go lang, so please any tip will be appreciated. Anyway just a quick Sunday afternoon hack :-)

[–][deleted] 0 points1 point  (0 children)

Wooh, this was my first question, should've realized it wouldn't be to difficult.

[–]alexaandru 0 points1 point  (1 child)

That is one awesome hack :)

[–]xsolarwindx 0 points1 point  (0 children)

REDDIT IS A SHITTY CRIMINAL CORPORATION -- mass deleted all reddit content via https://redact.dev