In a previous article, the author built a Node.js lambda function running in a container. Running a container as a serverless application worked out great: it meant it was simple to test locally and that I could install and use OS-level dependencies in a serverless function. That is how he was able to run Lynx in his AWS Lambda and build TextMode.
AWS Lambda’s and containers with Golang
So today’s mission is to port that Node.js code to Golang, running in a container. I’ll also be using OS dependencies in my container, and because TextMode is a very cacheable service, I’m going to use S3 to cache the results as well.
This article teaches how to build a Golang Lambda service in a container, hook it up to a REST API end-point, and push and pull data from S3.
Porting to Golang was a performance win.
It’s surprising to me how much faster the Golang version is. Lynx and the readability lib do the majority of the work. Perhaps the native readability lib is just a lot faster but I’m not sure without digging in further.