Choosing the Right AWS Service for Real-Time Scale

This title was summarized by AI from the post below.

🚀 𝗙𝗮𝗿𝗴𝗮𝘁𝗲 𝘃𝘀. 𝗟𝗮𝗺𝗯𝗱𝗮: 𝗖𝗵𝗼𝗼𝘀𝗶𝗻𝗴 𝘁𝗵𝗲 𝗥𝗶𝗴𝗵𝘁 𝗧𝗼𝗼𝗹 𝗳𝗼𝗿 𝗥𝗲𝗮𝗹-𝗧𝗶𝗺𝗲 𝗦𝗰𝗮𝗹𝗲 Following up on the Quiz Showdown architecture challenge, the choice of compute - 𝗔𝗪𝗦 𝗙𝗮𝗿𝗴𝗮𝘁𝗲 vs 𝗔𝗪𝗦 𝗟𝗮𝗺𝗯𝗱𝗮 was critical. We didn't just pick one; we chose the right one for each service's job. It all comes down to 𝗦𝘁𝗮𝘁𝗲𝗳𝘂𝗹𝗻𝗲𝘀𝘀 𝘃𝘀. 𝗘𝘃𝗲𝗻𝘁𝗳𝘂𝗹𝗻𝗲𝘀𝘀. 𝟭. 𝗔𝗪𝗦 𝗙𝗮𝗿𝗴𝗮𝘁𝗲: 𝗧𝗵𝗲 𝗟𝗼𝗻𝗴-𝗗𝗶𝘀𝘁𝗮𝗻𝗰𝗲 𝗥𝘂𝗻𝗻𝗲𝗿𝘀 🏃♂️ We chose 𝗙𝗮𝗿𝗴𝗮𝘁𝗲 (our serverless container engine) for services that need to run continuously and 𝗺𝗮𝗶𝗻𝘁𝗮𝗶𝗻 𝘀𝘁𝗮𝘁𝗲 in memory for a period of time.  • 𝗤𝘂𝗶𝘇 𝗦𝗲𝗿𝘃𝗶𝗰𝗲: This service is 𝗦𝘁𝗮𝘁𝗲𝗳𝘂𝗹. It must hold the live 𝗶𝗻-𝗺𝗲𝗺𝗼𝗿𝘆 𝗴𝗮𝗺𝗲 𝘀𝘁𝗮𝘁𝗲 (scores, connection IDs) for the entire 60-second quiz. Fargate provides the necessary 𝗣𝗲𝗿𝘀𝗶𝘀𝘁𝗲𝗻𝗰𝗲, guaranteeing the runtime needed to manage the entire session. If we used Lambda here, the game would crash between requests!  • 𝗠𝗮𝘁𝗰𝗵𝗺𝗮𝗸𝗶𝗻𝗴 𝗦𝗲𝗿𝘃𝗶𝗰𝗲: This requires a dedicated, 𝗮𝗹𝘄𝗮𝘆𝘀-𝗼𝗻 𝘄𝗼𝗿𝗸𝗲𝗿 𝗽𝗿𝗼𝗰𝗲𝘀𝘀 that continuously monitors the Redis queues. Fargate provides the 𝗖𝗼𝗻𝘁𝗶𝗻𝘂𝗼𝘂𝘀 𝗢𝗽𝗲𝗿𝗮𝘁𝗶𝗼𝗻 needed to run this background task efficiently. 𝟮. 𝗔𝗪𝗦 𝗟𝗮𝗺𝗯𝗱𝗮: 𝗧𝗵𝗲 𝗦𝗽𝗿𝗶𝗻𝘁 𝗦𝗽𝗲𝗰𝗶𝗮𝗹𝗶𝘀𝘁𝘀 💨 We chose 𝗟𝗮𝗺𝗯𝗱𝗮 (our event-driven serverless functions) for services that are short-lived, triggered by a specific event, and entirely 𝘀𝘁𝗮𝘁𝗲𝗹𝗲𝘀𝘀.  • 𝗦𝗰𝗼𝗿𝗶𝗻𝗴 𝗦𝗲𝗿𝘃𝗶𝗰𝗲: This is 𝗕𝘂𝗿𝘀𝘁𝘆 & 𝗦𝘁𝗮𝘁𝗲𝗹𝗲𝘀𝘀. It's only needed for a single task: calculate the score and push it to Kinesis. Lambda provides 𝗜𝗻𝘀𝘁𝗮𝗻𝘁 𝗦𝗰𝗮𝗹𝗲 & 𝗖𝗼𝘀𝘁 𝗘𝗳𝗳𝗶𝗰𝗶𝗲𝗻𝗰𝘆, scaling instantly to meet the massive burst of answers without pre-provisioning capacity, helping us meet that sub-200ms SLA.  • 𝗟𝗲𝗮𝗱𝗲𝗿𝗯𝗼𝗮𝗿𝗱 𝗦𝗲𝗿𝘃𝗶𝗰𝗲: This is 𝗔𝘀𝘆𝗻𝗰𝗵𝗿𝗼𝗻𝗼𝘂𝘀 & 𝗘𝘃𝗲𝗻𝘁-𝗗𝗿𝗶𝘃𝗲𝗻. It's triggered only when a GAME_ENDED event arrives from Kinesis. Lambda wakes up, updates the database, and shuts down. This maximizes 𝗖𝗼𝘀𝘁 𝗘𝗳𝗳𝗶𝗰𝗶𝗲𝗻𝗰𝘆 while ensuring reliable database writes. 𝗧𝗵𝗲 𝗧𝗮𝗸𝗲𝗮𝘄𝗮𝘆 By combining Fargate and Lambda, we achieved the best of both worlds: 𝗰𝗼𝘀𝘁 𝗼𝗽𝘁𝗶𝗺𝗶𝘇𝗮𝘁𝗶𝗼𝗻 and 𝗿𝗲𝗹𝗶𝗮𝗯𝗶𝗹𝗶𝘁𝘆. This layered approach is the essence of building a robust, modern cloud-native system. What trade-offs do you prioritize when choosing between containers and serverless functions for a real-time app? 🤔 #AWSServerless #Fargate #AWSLambda #SystemDesign #CloudNative #TechSeries

  • logo

To view or add a comment, sign in

Explore content categories