Serverless best practices

  • Make each function do only one thing. Avoid switch statements that make for large, complex functions that don’t scale well.
  • Don’t let functions call other functions.
  • Learn to use messages and queues to keep functions asynchronous.
  • Use as few libraries as possible (ideally none), to avoid slowing down cold starts and to avoid adding security risks.
  • One function per route (using HTTP). Avoid the single function proxy as it does not scale well and cannot isolate issues.
  • Treat data as flows and not ‘lakes’ at rest. Avoid querying from a lake; you need to rethink your data layer to avoid scaling issues and rigidity of data structures.

Full post here, 7 mins read