DEA-C01 Question 37
Select 2You are designing a real-time data processing application using AWS Kinesis Data Streams and AWS Lambda. The application processes incoming events to update user session data and stores the results in Amazon DynamoDB. Some of the events require maintaining the state of a user session (e.g., user activity history), while others only require processing individual events without relying on previous state. How should you design your application to handle both stateful and stateless transactions effectively?
- A
Use AWS Lambda with a DynamoDB table to persist state for stateful transactions and process stateless events directly in the Lambda function.
- B
Use Amazon Kinesis Data Analytics to maintain state for stateful transactions and process stateless events using SQL queries.
- C
Use AWS Step Functions to orchestrate the workflow, maintaining state for stateful transactions and processing stateless events in parallel branches.
- D
Use a single AWS Lambda function to handle both stateful and stateless transactions by managing state within the function's memory.
- E
Implement stateful transactions using Amazon S3 to store intermediate state and stateless transactions with AWS Lambda.
Show answer and explanation
Correct answers: A, C
Explanation
For real-time data processing applications, stateful and stateless transactions require different handling. AWS Lambda combined with DynamoDB is a common design pattern for managing stateful transactions while processing stateless transactions directly within the Lambda function. AWS Step Functions is another powerful tool for orchestrating workflows that mix stateful and stateless operations, as it can maintain state across steps and enable parallel processing. These approaches ensure scalability and reliability in your application.
- A. Correct.
Correct: AWS Lambda can persist state for stateful transactions using a DynamoDB table, while stateless events can be processed directly in the Lambda function. This approach leverages DynamoDB's scalability and low latency.
- B. Incorrect.
Incorrect: Amazon Kinesis Data Analytics is not typically used for maintaining state in the context of transactional data processing. It is more suitable for streaming analytics, not transactional workflows.
- C. Correct.
Correct: AWS Step Functions can maintain state across multiple steps and branches, making it a good choice for orchestrating workflows with both stateful and stateless transactions.
- D. Incorrect.
Incorrect: Using a single AWS Lambda function to handle both stateful and stateless transactions with in-memory state is not a scalable or reliable solution. Lambda functions are stateless by design, and relying on in-memory state can lead to inconsistencies.
- E. Incorrect.
Incorrect: Amazon S3 is not well-suited for managing state in real-time transactional workflows. It is designed for object storage, not low-latency state management.