Live data from Hacker News

Show HN: I wrote a book about using Lambda with Go

news.ycombinator.com

11–19 of 19 posts

Re: Show HN: I wrote a book about using Lambda with Go

#11

Golang is great for lambda - you compile in the entire lambda runtime and end up with a single 20MB executable that does everything needed. Other runtimes have a couple hundred megabytes of overhead for the lambda runtime and AWS SDK (though you don’t see the overhead unless your doing the ECR based lambdas). The part I’ve always struggled with is cloudformation only lets you inline 4K of code. The underlying api all…

What I've started doing (and how I cover it in the book) is using the CDK to build and deploy the Lambda code. The `GoFunction`[0] construct handles building and deploying the code, so you don't have to set anything up manually.

Underneath it still happens by way of S3 & CloudFormation, but the CDK abstracts away a lot of the details, which makes it quite convenient to use.

[0] https://docs.aws.amazon.com/cdk/api/latest/docs/aws-lambda-g...

Re: Show HN: I wrote a book about using Lambda with Go

#12
post #8

Any experience with cold start times? I wrote a relatively simple lambda handler in Go, expecting it to be fast, but node seems to beat it. The Go version's memory usage is better, though.

I found usually they'd be on the order of a few hundred milliseconds. They tend to be quicker if you have more memory allocated to your function (because the additional CPU power helps).

I've mostly found that my cold starts were slow enough to look bad in the metrics, but fast enough (and rare enough) that the impact on user experience wasn't actually that noticeable. Given the other benefits I was getting from Lambda (like the easy scaling and low maintenance), it was worth the occasional small blip in latency.

And for functions that aren't directly user facing -- like processing items from a queue -- I've not found it to be an issue at all.

Of course every use case is different though, and some apps can tolerate this more than others.

Re: Show HN: I wrote a book about using Lambda with Go

#13
post #4

I have used Lambda extensively over the past three months in Python, Ruby and Node. The largest game changer for me was discovering Lambda Layers and realizing how I could avoid compiling zip folders to deploy. I’ve loved the iteration speed and performance, and recently have depended heavily on the Lambda + EFS combo. I purchased the book and was surprised there wasn’t more on the EFS usage, but otherwise the book l…

What you described with Lambda Layers sounds like a thin layer over Lambda container images[0]. What are the benefits to using traditional lambda + lambda layers vs lambda container images? 0. https://docs.aws.amazon.com/lambda/latest/dg/images-create.h...

My understanding is that a custom lambda image is the nuclear option; having everything fit cleanly into a normal lambda archive is the preferred option; and lambda layers are a type of middle ground if you've outgrown one but don't quite need the other.

Re: Show HN: I wrote a book about using Lambda with Go

#15

Just curious, what did you typeset the book with?

I used Asciidoctor. It's mostly the default theme, but I tweaked a few things about it.

If you're interested in the details, I wrote a blog post that goes into it a bit more: https://www.kevinwmcconnell.com/writing/how-i-wrote-my-book

That post also has a link to a repo with all the settings/theme/etc, so anyone can take it and use it as a starting point for their own book.

Re: Show HN: I wrote a book about using Lambda with Go

#16

Just curious, what did you typeset the book with?

I used Asciidoctor. It's mostly the default theme, but I tweaked a few things about it. If you're interested in the details, I wrote a blog post that goes into it a bit more: https://www.kevinwmcconnell.com/writing/how-i-wrote-my-book That post also has a link to a repo with all the settings/theme/etc, so anyone can take it and use it as a starting point for their own book.

Thanks!

Re: Show HN: I wrote a book about using Lambda with Go

#17

Just curious, what did you typeset the book with?

I used Asciidoctor. It's mostly the default theme, but I tweaked a few things about it. If you're interested in the details, I wrote a blog post that goes into it a bit more: https://www.kevinwmcconnell.com/writing/how-i-wrote-my-book That post also has a link to a repo with all the settings/theme/etc, so anyone can take it and use it as a starting point for their own book.

In the article, you reference `asciidoctor-epub`—I think you mean `asciidoctor-epub3`? Might be worth updating or correcting me here.

Re: Show HN: I wrote a book about using Lambda with Go

#18
post #8

Any experience with cold start times? I wrote a relatively simple lambda handler in Go, expecting it to be fast, but node seems to beat it. The Go version's memory usage is better, though.

Somewhat related, Lambda has the concept of provisioned capacity. So you can have a certain number of lambda containers running at all times, which will help a lot with the cold start. Obviously this is more expensive so you will have to weigh the benefits for your use case.

Re: Show HN: I wrote a book about using Lambda with Go

#19

Earlier quoted context omitted.

I used Asciidoctor. It's mostly the default theme, but I tweaked a few things about it. If you're interested in the details, I wrote a blog post that goes into it a bit more: https://www.kevinwmcconnell.com/writing/how-i-wrote-my-book That post also has a link to a repo with all the settings/theme/etc, so anyone can take it and use it as a starting point for their own book.

In the article, you reference `asciidoctor-epub`—I think you mean `asciidoctor-epub3`? Might be worth updating or correcting me here.

Ah yes, you're right! Thanks, I'll fix that.
Post reply on HN