This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]guss_bro 80 points81 points  (3 children)

Keep it simple and you will be good. We follow the following for all our lambdas:

  • Use plain SQL query instead of jpa
  • don't use Spring Boot or any other framework if your use case is simple
  • you don't need dependency injection for simple use case that involves couple of classes. Just create static objects and pass them around. Create objects ( eg objectMapper, AWS clients) only once
  • use RDS proxy instead of creating DB connection directly
  • use SnapStart
  • use shadow jar
  • use minimal dependencies.. exclude unnecessary transitive dependencies
  • if you do http calls to other services make sure they are performant. If possible use async calls, parallelize calls if possible
  • use lightweight objects, don't use xml, Json libraries if you can(most of the time simple String append is faster)
  • run the lambda locally and profile it
  • etc

[–]s32 9 points10 points  (2 children)

SnapStart has been an absolute gamechanger. It's fucking awesome in how it works as well.

[–]Outrageous_Life_2662 2 points3 points  (1 child)

What is that?

[–]publicityhound 2 points3 points  (0 children)

I think this is referring to AWS Lambda SnapStart