Reducing Clojure Lambda Cold Starts Part 2 - VPC

Search for a command to run...

No comments yet. Be the first to comment.
Me and ClojureScript At various companies, I spearheaded migrations many front-end migrations, from unresponsive JSPs and ASPs to responsive but out of control jQuery SPAs; to more structured but slow-compiling and extremely verbose GWTs; back to pur...
If you are using the v2 AWS SDK clients, you can configure them like so: (ns my.s3 (:import (java.net URI) (software.amazon.awssdk.regions Region) (software.amazon.awssdk.services.s3 S3Client) (software.amazon.awssdk.services.s3.mo...
Last time we created our Rust and Typescript Lambdas with basic hello world implementations and did a quick performance comparison. We'll now expand our Rust and Typescript Lambdas from last time into ones that take data from SQS messages and push th...

In this series, I will be investigating throughput tuning for a Lambda that receives SQS events, reads data from S3 object, and blasts the data into DynamoDB. While I'm at it, I'll do a performance shootout between Rust and Typescript versions, attem...

Where Lambda cold starts often get worse in other runtimes is when you start adding dependencies, particularly an AWS SDK dependency. Let's see how Rust fares with an S3 client dependency. Updating Cargo.toml: [package] name = "tax_engine_experiments...

Rust seems to be at the height of the hype cycle right now even among functional programming enthusiasts. Although it's not a true functional programming language, due to not having first-class support for immutable data structures, its ownership mod...

After my last post Reducing Clojure Lambda Cold Starts Part 1 - Baseline, I remembered that a few years back, Lambdas within a VPC had some pretty terrible cold start times. Doing a comparison seemed like low-hanging fruit so I decided to run the same experiment, but with the Lambda in a VPC:
AWSTemplateFormatVersion: "2010-09-09"
Transform:
- "AWS::Serverless-2016-10-31"
Resources:
RunCalculationsQueue:
Type: AWS::SQS::Queue
Properties:
QueueName: !Sub "${AWS::StackName}-run-calcs-queue"
VisibilityTimeout: 5400
RunCalculations:
Type: AWS::Serverless::Function
Properties:
FunctionName: !Sub "${AWS::StackName}-run-calcs"
Handler: tax.core::calculationsHandler
Runtime: java11
CodeUri: target/tax-engine-0.1.0-standalone.jar
Timeout: 900
MemorySize: 2048
Policies:
- AWSLambdaBasicExecutionRole
Events:
SQSEvent:
Type: SQS
Properties:
Queue: !GetAtt RunCalculationsQueue.Arn
BatchSize: 1
VpcConfig:
SubnetIds:
- <<cool subnet 1>>
- <<cool subnet 2>>
SecurityGroupIds:
- <<cool security group>>
Outputs:
QueueUrl:
Value: !Ref RunCalculationsQueue
The results were slightly better 2.5750404 seconds over 83 cold starts, but the difference is probably not statistically significant given the low number of trials. So it seems that VPCs are truly no longer an issue, so on to the next experiment.