This project shows how to run up to thousands of concurrent instances of Lighthouse on AWS Lambda. For more detail check out the blog post about it.
Here is a picture of how it works:
ββββββββββββββββββββββββββββ
βSNS topic for dead lettersβ
ββββββββββββββββββββββββββββ
β²
β
ββββββββββββΌββββββ
ββββββββββββββββββ ββββββββββββΌββββββ΄β
β β βββββββββββββββββ βββββββββββββββββββ΄β ββββββββββββββββββββββββββ
βββββββββββββ βLambda function β β β βββLambda function β β Lambda function #3 β
β Lambda β β #1 β β SNS topic for β βββ #2 β β β
β client or ββββββΆβ βββββΆβ test runs βββββββββΌβΆβ β β Subscribed to dynamo β
βAWS consoleβ β Initializer β β β ββ€β Lighthouse β β stream to hook into β
βββββββββββββ β β β β ββ€ worker β βmoment of Job completionβ
ββββββββββββββββββ βββββββββββββββββ βββββββββββββββ¬βββ ββββββββββββββββββββββββββ
β β² β β²
β βββββββββββββββββββββββββββΌβββββΌβββββββββββββββββββ
β β β β
β β β β
β ββββββββββββββββββββ β β
β β DynamoDB β β β
β β β β β
ββββββββββββΆβMetadata and stateββββββββββββββββββ βΌ
βfor Jobs and Runs β βββββββββββββββββββββββ
ββββββββββββββββββββ β S3 β
β β
β Full lighthouse β
β reports β
βββββββββββββββββββββββ
- aws account
- aws access credentials (pretty much admin access required) (not really but you'll be creating a number of things -- see
infra.tfto come up with the exact requirements) - Terraform (I'm using v0.11.11)
- python3 (to invoke CLI)
- boto3 (to invoke CLI)
- nodejs 8.10
- yarn
touch lambdas/dist/init.zip lambdas/dist/worker.zip lambdas/dist/post-processor.zipyarnto install dependencies inside each of thelambdas/srcdirectories- Change the
localsblock ininfra.tfas needed for your org name, region, creds file path, etc. terraform initterraform planterraform apply
- Put JSON list of urls in
urls.json ./lighthouse-parallel urls.json --runs 1000
- Infrastructure changes: just
terraform apply - JS code changes: increment
locals.app_versionand thenterraform apply(probably not a great idea to use TF to manage the lambda functions' deployment, but this is a prototype, didn't want to add Another Tool)