Soru

Zorluk: OrtaData Store Operations with Amazon DynamoDB

A developer is building a vehicle fleet tracking application that stores telemetry data in an Amazon DynamoDB table. The table is configured with a partition key of `VehicleIDVehicleID` and a sort key of `TimestampTimestamp`. The application needs to support two access patterns: retrieving the history of a specific vehicle within a given time range, and retrieving telemetry records matching a specific `SpeedSpeed` across the entire fleet of vehicles. Some partitions are experiencing throttling due to high-frequency read requests.

Which two actions should the developer take to implement these queries efficiently and resolve the throttling issue?

  1. Create a Global Secondary Index (GSI) with a partition key of `SpeedSpeed` to query speeding violations across all vehicles.Cevap
  2. Use the `Query` API operation on the base table with a key condition expression specifying the `VehicleIDVehicleID` and a range condition on the `TimestampTimestamp`.Cevap
  3. C
    Use a `Scan` API operation on the base table with a `FilterExpression` on the `SpeedSpeed` attribute to identify speeding violations across all vehicles.
  4. D
    Increase the overall provisioned Read Capacity Units (RCUs) of the base table to mitigate the partition throttling issues.
  5. E
    Initialize the AWS SDK DynamoDB client inside the application by hardcoding an IAM user's access keys to ensure authorized access to the table.

Cevap

Create a Global Secondary Index (GSI) with a partition key of speed, and use the Query API operation on the base table with a key condition expression specifying the vehicle identifier and a range condition on the timestamp.
The correct approach involves using the Query API operation on the base table to retrieve a vehicle's history because it targets a single partition key and filters by the sort key range efficiently. Additionally, to retrieve records by speed across all vehicles, a Global Secondary Index (GSI) must be created with speed as the partition key, which allows executing Query operations rather than scanning the entire table.

Adım Adım Çözüm

1
Analyze the access pattern for retrieving the telemetry records for a specific vehicle over a time range.
Since the base table partition key is the vehicle identifier and the sort key is the timestamp, using the Query operation with a key condition expression on both keys retrieves the desired data efficiently.
The Query operation operates directly on a single partition key, avoiding full table scans.
2
Analyze the access pattern for retrieving telemetry records matching a specific speed across all vehicles.
Since the partition key of the base table is the vehicle identifier, querying across all vehicles requires a Global Secondary Index (GSI) with speed as the partition key.
A GSI allows querying across all partitions of the base table using a new partition key.
3
Address the partition throttling issue caused by high-frequency read requests.
Throttling on specific keys cannot be resolved simply by increasing overall table capacity; utilizing a GSI can distribute the read workload or caching can be implemented.
Provisioned capacity is distributed across partitions, so hot partition issues require key design or indexing strategies rather than just increasing overall RCUs.

Anahtar Kavram

DynamoDB querying and indexing strategies using Query operations and Global Secondary Indexes (GSIs) to optimize performance and prevent hot partitions.
Bu soruyu puanla