Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Caching in AWS Lambda

Caching in AWS Lambda

You want to optimize your performance in your AWS Lambda functions and reduce infrastructure costs by avoiding expensive API calls? You should think about caching data in your function! In this talk, I'll show you three different options how to cache data in Lambda: simple caching, custom caching and managed caching.

sebastianhesse

December 06, 2018
Tweet

More Decks by sebastianhesse

Other Decks in Programming

Transcript

  1. Available options to cache data in AWS Lambda and how

    to use them. CACHING IN AWS LAMBDA
  2. BETTER PERFORMANCE Avoid slow API calls or computations. REDUCE COSTS

    Avoid calls which cost you money, e.g. to your database. REASONS
  3. LAMBDA SCALING GET Name for X GET Name for X

    GET Name for X GET Name for X DynamoDB
  4. CUSTOM Setup a caching instance by your own. CACHING OPTIONS

    MANAGED Use a managed caching service. SIMPLE Cache data only inside Lambda functions.
  5. LAMBDA EXECUTION PROCESS Response Time (ms) 0 250 500 750

    1000 # Number Of Request 1 2 3 4 5 6 7 8 9 10 Cold start
  6. AFTER No data synchronization between instances of your Lambda functions.

    BEFORE Low cost caching without performance overhead.
  7. CUSTOM CACHING SETUP 1.) GET Name for X CACHE 2.)

    GET Name for X 3.) SET Name for X DynamoDB
  8. "Whe; /4: la@;Ah B; EC2 in.9-nH6 Iit84:9 sJeA=fLM5g a .@On6),

    it's a@)QRat=HBSlL Sa@nHT6d i;94 B deV-:St .uOnX) M5 yo@[ <6fa@\9 V^_." https://docs.aws.amazon.com/vpc/latest/userguide/default-vpc.html —
  9. "By 3ea-:l), re.4:bce. I=t8M5 a V^_ -r6 ;o9 -cH6dsieSX f[QR

    wi)T=n B LahOd- V:5c)i45" https://docs.aws.amazon.com/lambda/latest/dg/vpc.html —
  10. LAMBDA VPC STARTUP VPC Network Hardware Image: https://www.flaticon.com/free-icon/network-interface-card_969356 "A Serverless

    Journey: AWS Lambda Under the Hood" https://www.youtube.com/watch?v=QdzV04T_kec&t=2400
  11. MAINTENANCE AWS is regularly taking care of updates. ADVANTAGES COMPATIBILITY

    Redis and Memcached well supported caching solutions. GET STARTED Easy setup and ready to go.
  12. SEBASTIAN HESSE Software Engineer | www.k15t.com | @seeebiii CHARLIE IS

    MY HOMEBOY CHARLIE IS MY HOMEBOY K15t Software Example code @ GitHub: https://github.com/seeebiii/caching-in-aws-lambda
  13. NEW MEETUP SERIES: K15T TEAM TALKS TOPIC: GIT TOGETHER More

    information: https://www.meetup.com/de-DE/K15tTeamTalks/events/256232999/