Skip to content

Skill 1.1.3: Troubleshoot and debug data ingestion and storage issues that involve capacity and scalability.


Question 1 - Kinesis Consumer Lag Diagnosis

A retail analytics company ingests clickstream events into Amazon Kinesis Data Streams with 20 shards. A downstream AWS Lambda consumer processes these events and writes enriched records to Amazon S3.

Over the past week, the Lambda consumer's IteratorAge metric has steadily increased from seconds to over 6 hours, while the Lambda's Throttles metric remains at zero. The Lambda function writes to S3 asynchronously using the AWS SDK, and the incoming record rate has not increased. The company needs to resolve the backlog while minimizing operational changes.

Which action should a machine learning engineer take?

  • A) Increase the Kinesis Data Stream shard count from 20 to 40.
  • B) Increase the Lambda function's reserved concurrency to match the stream shard count.
  • C) Reduce the size of each record by compressing the clickstream payload before writing to Kinesis.
  • D) Increase the Kinesis Data Stream retention period from 24 hours to 7 days.
  • E) Enable Kinesis Enhanced Fan-Out (EFO) and register the Lambda as an EFO consumer.
Click to reveal Answer & Explanation

Correct Answer: E

Correct Option Analysis

  • E is Correct: The steadily increasing IteratorAge with zero throttles indicates the consumer is falling behind without being throttled. With standard Kinesis consumers (shared throughput), each shard provides a fixed read throughput (~2 MB/s aggregate per shard). Enhanced Fan-Out (EFO) provides each registered consumer a dedicated 2 MB/s per shard read throughput, effectively doubling the read capacity for this consumer without adding shards. With 20 shards, EFO gives the Lambda consumer 40 MB/s dedicated throughput instead of the shared 20 MB/s. This resolves the backlog with minimal operational change and no extra shard cost besides the EFO data retrieval charges.

Distractor Analysis

  • A is Incorrect: Increasing shard count adds capacity for write throughput and more parallel consumers, but the incoming record rate has not increased. The bottleneck is consumer read throughput, not producer write throughput. Additional shards increase cost without addressing the root cause.
  • B is Incorrect: Lambda reserved concurrency limits the maximum number of concurrent Lambda invocations, but if the consumer is hitting the Kinesis shared read throughput limit rather than the Lambda invocation limit, adding reserved concurrency won't help. Lambda's Throttles metric is zero, meaning Lambda isn't throttling requests.
  • C is Incorrect: Reducing record size is a producer-side change that can help if the bottleneck is provisioned write throughput. Since the incoming rate is unchanged and the backlog grew, the issue is on the consumer side, not a record size problem.
  • D is Incorrect: Increasing the retention period changes how long data is stored in the stream before being trimmed, which is useful for replay scenarios but does not affect the rate at which the consumer can read and process data.

Key Takeaway: When Kinesis consumers lag without throttling, add consumer-side read throughput via Enhanced Fan-Out (each consumer gets dedicated 2MB/s per shard) instead of adding shards (which only increases write capacity).

Question 2 - OpenSearch Vector Index Scaling

A generative AI application uses Amazon OpenSearch Service to store vector embeddings for a retrieval-augmented generation (RAG) pipeline. The vector index currently holds 5 million embeddings (1536 dimensions, float32) in a cluster with 3 data nodes of r6g.xlarge.search instance type and 512 GiB EBS GP3 storage per node.

The data science team expects the vector collection to grow to 50 million embeddings in the next three months. Users are already reporting slower query latency, and the cluster's JVMMemoryPressure frequently exceeds 85%. The company must scale the cluster while keeping operations simple.

Which TWO actions should the team take? (Select TWO)

  • A) Increase the EBS volume size on each data node to 2 TiB.
  • B) Increase the number of data nodes and configure the index to use multiple shards to distribute the vector search load.
  • C) Switch to r6gd.2xlarge.search instances (graviton with local NVMe SSD) for lower query latency.
  • D) Migrate the vector data to Amazon S3 and use S3 Select for vector similarity queries.
  • E) Reduce vector dimensions from 1536 to 256 using Principal Component Analysis (PCA) and re-ingest all embeddings.
Click to reveal Answer & Explanation

Correct Answers: B and E

Correct Options Analysis

  • B is Correct: Adding more data nodes and shards is the fundamental scaling approach in OpenSearch for larger vector indexes. More shards distribute the k-NN search across more nodes, increasing both memory capacity (to hold more vectors in memory) and CPU parallelism (to compute similarity scores faster). For a 10x growth in vector count, you need proportionally more memory and compute.
  • E is Correct: Reducing vector dimensions through PCA or embedding model distillation (e.g., using a 256-dimensional embedding model like Cohere Embed v3 with reduced dimensions) dramatically reduces memory footprint (4x to 6x reduction) and query latency while retaining most of the retrieval quality. This is a valid optimization when scaling from millions to tens of millions of vectors.

Distractor Analysis

  • A is Incorrect: Increasing EBS volume size only increases storage capacity, not vector search performance. OpenSearch k-NN search typically requires vectors to fit in JVM memory or native memory (via nmslib or faiss engines), so JVM memory pressure remains high. Disk expansion alone won't resolve the memory constraint.
  • C is Incorrect: Switching to local NVMe SSD can improve data transfer speeds from disk, but if JVM memory pressure is the issue, storage performance is secondary. Also, r6gd instance types still have similar memory-to-vCPU ratios; the real bottleneck is memory capacity for vector data.
  • D is Incorrect: S3 Select supports SQL-like queries over CSV, JSON, and Parquet objects in S3, but it does not support vector similarity search (k-NN). Vector search requires a specialized index or vector database.

Key Takeaway: Vector search scaling in OpenSearch is driven by memory and shard distribution—increase data nodes and shards, and consider reducing embedding dimensions to manage memory footprint.

Question 3 - SageMaker Feature Store Throughput Bottleneck

An e-commerce company uses Amazon SageMaker Feature Store for real-time fraud detection inference. The online store is configured with a default throughput capacity. During flash sales, the inference endpoint experiences timeout errors, and the feature store's OnlineStoreWriteLimitExceeded and OnlineStoreReadLimitExceeded metrics spike simultaneously.

The company requires the online store to handle sudden 10x traffic spikes without disruption, and they want a cost-effective solution. Which action should the ML engineer take?

  • A) Increase the online store's write and read throughput capacity and enable automatic throughput scaling based on utilization metrics.
  • B) Switch the online store to use a provisioned write capacity with a manually higher limit, but keep read capacity unchanged.
  • C) Migrate all feature data to the offline store only and serve features from S3 using Athena for each inference request.
  • D) Use Amazon SageMaker Feature Store's batch transform mode for all online inference calls.
  • E) Store features in a separate Amazon DynamoDB table with on-demand scaling and disable SageMaker Feature Store entirely.
Click to reveal Answer & Explanation

Correct Answer: A

Correct Option Analysis

  • A is Correct: SageMaker Feature Store's online store throughput can be configured for read and write capacity. The OnlineStoreWriteLimitExceeded and OnlineStoreReadLimitExceeded metrics indicate both read and write throughput limits were hit during traffic spikes. Increasing both read and write throughput capacity resolves the bottleneck for handling sudden spikes. SageMaker Feature Store supports automatic throughput scaling, which dynamically adjusts capacity based on utilization to handle variable traffic patterns—this is both cost-effective (no over-provisioning at all times) and operationally simple.

Distractor Analysis

  • B is Incorrect: Increasing only write capacity while keeping read capacity unchanged ignores the OnlineStoreReadLimitExceeded spike. Both read and write throughput must be increased proportionally to handle inference load.
  • C is Incorrect: The offline store in SageMaker Feature Store is optimized for batch operations (using Spark, Athena, or EMR) and is not designed for low-latency, real-time feature lookups during inference. Querying S3 via Athena adds multi-second or even minute-level latency.
  • D is Incorrect: Batch transform mode is a SageMaker inference option for offline or batch predictions, not for real-time feature retrieval during online inference. It does not address the feature lookup latency and throughput problem.
  • E is Incorrect: While DynamoDB with on-demand scaling can handle high traffic, this introduces architectural complexity and requires duplicating feature engineering logic, losing the benefits of a shared feature definition between training and inference (which is a core feature of SageMaker Feature Store).

Key Takeaway: When SageMaker Feature Store's online store hits throughput limits, increase both read and write capacity (and enable auto-scaling if available) rather than falling back to batch-based or custom-built solutions.

Question 4 - MSK Consumer Lag from Downstream Throttling

A data platform ingests IoT device telemetry into Amazon MSK (Kafka). A Spark Streaming application (running on Amazon EMR) consumes from Kafka topics, transforms the data, and writes results to Amazon DynamoDB tables.

The Kafka consumer group's records-lag metric has increased by 200% per hour for the last 6 hours. Simultaneously, DynamoDB logs show WriteThrottledRequests at 95% of all write requests. The EMR cluster's CPU utilization is under 30%, and adding more Kafka consumer partitions does not help. The company needs to reduce the lag without increasing DynamoDB provisioned capacity.

Which action is most appropriate?

  • A) Increase the number of EMR core nodes to add more Spark executors.
  • B) Configure the Spark Streaming job to reduce batch interval from 10 seconds to 1 second.
  • C) Implement exponential backoff and retry logic in the Spark Streaming consumer for throttled DynamoDB writes.
  • D) Switch to Amazon Kinesis Data Streams instead of Kafka to eliminate consumer lag.
  • E) Increase the Kafka topic partition count from 24 to 48.
Click to reveal Answer & Explanation

Correct Answer: C

Correct Option Analysis

  • C is Correct: The root cause of the lag is not consumer compute capacity (EMR CPU is at 30%) or Kafka partitions; it's the downstream DynamoDB throttling. When DynamoDB throttles writes, the Spark consumer needs to handle ProvisionedThroughputExceededException or WriteThrottledRequests gracefully by retrying with exponential backoff and jitter. Without retry logic, failed writes may cause the Spark job to drop records or block, creating backpressure and increasing lag. Implementing exponential backoff and retry allows writes to eventually succeed without overloading DynamoDB.

Distractor Analysis

  • A is Incorrect: The EMR cluster's CPU utilization is under 30%, meaning the Spark executors are not the bottleneck. Adding more nodes or executors would not help if DynamoDB is throttling writes.
  • B is Incorrect: Reducing batch interval from 10 seconds to 1 second increases the frequency of micro-batches, meaning more concurrent write requests to DynamoDB, potentially worsening throttling. This increases write pressure rather than reducing it.
  • D is Incorrect: Switching from Kafka (MSK) to Kinesis Data Streams is a large architectural migration that does not directly solve the DynamoDB throttling issue. The same downstream throttling problem would persist even with Kinesis.
  • E is Incorrect: Increasing Kafka partition count affects consumer parallelism, but since the consumer is not CPU-bound (30% utilization), adding more partitions would just increase the number of parallel write requests to DynamoDB, aggravating throttling.

Key Takeaway: When stream consumer lag is caused by downstream throttling (e.g., DynamoDB WriteThrottledRequests), add retry + backoff logic in the consumer, not more compute or partitions—those just add more pressure to the throttled target.

Question 5 - S3 Metadata Retrieval Performance Bottleneck

A computer vision team stores image datasets in Amazon S3 for model training. Each training job reads images from a bucket with over 10 million objects. Training jobs are launched from SageMaker Training, and the job reads image paths from a CSV manifest file that lists all object keys.

During training, the team observes that the first epoch takes 2 hours even though the model's compute is not saturated. The S3 bucket uses the standard storage class, and the manifest CSV is stored alongside the images. The team wants to improve training data loading performance with minimal code changes.

Which action should the team take?

  • A) Enable S3 Transfer Acceleration on the bucket to speed up data retrieval.
  • B) Switch the bucket to S3 Express One Zone storage class and update the training job's data source location.
  • C) Split the manifest CSV into multiple shards and use a distributed data loading strategy per worker.
  • D) Use S3 Select to query the manifest file for faster object key retrieval.
  • E) Move the manifest file to an in-memory cache such as Amazon ElastiCache for Redis before training.
Click to reveal Answer & Explanation

Correct Answer: B

Correct Option Analysis

  • B is Correct: S3 Express One Zone is a high-performance storage class designed for latency-sensitive applications requiring 10x faster read performance and lower request costs compared to S3 Standard. It is ideal for training workloads where frequent access to large numbers of small objects (images) causes latency bottlenecks. Switching to S3 Express One Zone improves data read speed without code changes—simply point the training job to the new bucket or directory.

Distractor Analysis

  • A is Incorrect: S3 Transfer Acceleration speeds up uploads/downloads over long distances (e.g., from on-premises to S3), but it does not improve read performance for repeated access or reduce the number of GET operations during training.
  • C is Incorrect: Splitting the manifest CSV into multiple shards and using distributed data loading requires significant code changes in the training pipeline and likely won't address the root cause—the latency of reading individual objects from S3. While it may improve parallelism, the overhead of reading from S3 Standard remains.
  • D is Incorrect: S3 Select enables querying data within a single object (e.g., filter rows from a CSV), but it does not speed up the retrieval of millions of image objects. It doesn't address the fundamental object retrieval latency.
  • E is Incorrect: Moving the manifest file to ElastiCache for Redis only speeds up manifest file parsing, not image retrieval from S3. The manifest fetching is negligible compared to the time spent reading image data from S3.

Key Takeaway: For training jobs with high-frequency object access, S3 Express One Zone offers 10x lower latency compared to S3 Standard; data loading bottlenecks from many small objects should be addressed with faster storage, not just more parallelism.

Question 6 - AWS Glue Job Out-of-Memory When Processing Partitioned Data

A data engineering team runs a nightly AWS Glue ETL job (Spark-based, G.1X DPUs) to transform raw JSON logs stored in Amazon S3 into Apache Parquet format in a curated S3 bucket. The raw logs are partitioned by year/month/day/hour, and each partition contains between 1 and 50 files of varying sizes (1 KB to 2 MB).

The Glue job has been running successfully for months, but now fails with ExecutorLostFailure: Container killed by YARN for exceeding memory limits. The data volume has increased by 200% in the last week due to new logging features. The team wants to fix the job with minimal changes to the ETL logic.

Which action should the team take?

  • A) Increase the Glue job's worker type from G.1X to G.2X and increase the number of DPUs.
  • B) Enable S3 lifecycle policy to expire old raw logs.
  • C) Configure the Glue job to use the new AWS Glue Flex execution class for lower memory usage.
  • D) Add a repartition() transformation to increase partition count from 200 to 2000 before writing.
  • E) Switch the output format from Parquet to CSV to reduce memory during write.
Click to reveal Answer & Explanation

Correct Answer: A

Correct Option Analysis

  • A is Correct: The failure message "Container killed by YARN for exceeding memory limits" indicates the Spark executors ran out of memory while processing the larger data volume. G.1X workers provide 16 GB memory per DPU, while G.2X provides 32 GB per DPU. Increasing the worker type to G.2X and/or increasing the number of DPUs gives Spark more memory per executor and more executors, allowing the job to handle the 200% increase in data volume without code changes.

Distractor Analysis

  • B is Incorrect: S3 lifecycle policies manage data retention and cost, not the amount of data the Glue job must process. Expiring old raw logs would reduce historical data processed but not the current incoming data volume.
  • C is Incorrect: AWS Glue Flex is a cost-optimized execution class that may have lower memory allocation per DPU compared to standard Glue execution. It is not designed to solve out-of-memory problems; it may actually worsen them if memory is the constraint.
  • D is Incorrect: Adding a repartition() transformation to increase partition count from 200 to 2000 could help spread data more evenly across executors, but it may also increase shuffle overhead and memory usage for shuffle operations. The primary issue is total memory capacity, which repartition() doesn't add.
  • E is Incorrect: Switching from Parquet to CSV is a change to the output format that would likely increase write time and file size, not reduce memory usage. CSV is a row-oriented format and generally less efficient for data processing.

Key Takeaway: When Glue/Spark jobs fail with ExecutorLostFailure due to increased data volume, scale vertically (increase worker type G.1X → G.2X) or horizontally (more DPUs) to provide more memory.

Question 7 - DynamoDB Point-in-Time Recovery for Training Data

A financial services company ingests transaction data into Amazon DynamoDB for real-time fraud model feature computation. The table stores 10 TB of data and handles 50,000 requests per second during peak hours. Compliance mandates that the company must be able to restore the DynamoDB table to any point in the last 35 days for audit and model retraining purposes.

The company needs to implement this requirement with minimum operational overhead and minimal impact on table performance.

Which feature should the company enable?

  • A) DynamoDB Streams with a Lambda consumer that copies records to an S3 bucket.
  • B) DynamoDB Accelerator (DAX) with a 35-day cache window.
  • C) DynamoDB Point-in-Time Recovery (PITR) with a 35-day recovery window.
  • D) DynamoDB Global Tables with a manual snapshot schedule and retention of 35 days.
  • E) DynamoDB on-demand backup with a 35-day retention period and scheduled hourly backups.
Click to reveal Answer & Explanation

Correct Answer: C

Correct Option Analysis

  • C is Correct: DynamoDB Point-in-Time Recovery (PITR) provides continuous backup with per-second granularity, allowing you to restore the table to any point in time within the specified recovery window (up to 35 days). It operates without affecting table performance or requiring manual snapshot scheduling. PITR is fully managed and requires no code changes—simply enable it on the table.

Distractor Analysis

  • A is Incorrect: DynamoDB Streams with a custom Lambda consumer to copy records to S3 requires building and maintaining a custom pipeline. While it can preserve historical data, it doesn't provide point-in-time recovery of the table itself and adds operational overhead. Compliance requirement is for table PITR.
  • B is Incorrect: DAX is an in-memory cache for DynamoDB designed to reduce read latency. It does not provide any backup or recovery functionality and is not relevant to compliance mandates for data retention.
  • D is Incorrect: DynamoDB Global Tables replicate data across Regions for availability and disaster recovery. Manual snapshot scheduling across regions does not provide automatic point-in-time recovery and adds complexity for compliance purposes.
  • E is Incorrect: On-demand backups provide full snapshots of the table at a specific point in time, but hourly scheduled backups only provide hourly granularity, not per-second. PITR is more granular and has no performance impact compared to manual snapshot scheduling.

Key Takeaway: For compliance requirements involving point-in-time recovery, DynamoDB PITR offers continuous, per-second granularity with no performance overhead—simpler and more effective than manual backups or custom pipelines.

Question 8 - S3 Bucket Key Prefix Performance Limits

A ML platform teams uses Amazon S3 to store training datasets for a recommendation system. The bucket contains 100 TB of Parquet files organized by dataset_name/date/partition_id/. A SageMaker Training job reads these files using PyTorch's S3Dataset iterable.

The team observes that data loading throughput is capped at ~5 Gbps per training instance, even though the instance's network bandwidth supports 100 Gbps. The bucket is in the same AWS Region as the training instances. The team wants to maximize data loading throughput without increasing compute or changing the data format.

Which action should the team take?

  • A) Enable S3 Multi-Region Access Points (MRAP) for the bucket.
  • B) Reorganize the data into random key prefixes and use multiple S3 prefixes for parallel access.
  • C) Increase the instance's EBS volume capacity to cache data locally before training.
  • D) Use S3 Transfer Acceleration to increase throughput from S3 to the training instance.
  • E) Set the AWS_REGION environment variable to us-east-1 for all training jobs, regardless of actual region.
Click to reveal Answer & Explanation

Correct Answer: B

Correct Option Analysis

  • B is Correct: S3 automatically scales throughput based on the number of unique key prefixes. A single prefix (or a small number of prefixes) can become a hot spot, capping throughput at ~5,500 GET/HEAD requests per second per prefix. With large files and high network bandwidth, the bottleneck is the number of parallel S3 GET operations. By spreading data across many random key prefixes (e.g., using a hash prefix), S3 can parallelize access across multiple internal partitions, increasing overall throughput. This requires no changes to the data format or compute.

Distractor Analysis

  • A is Incorrect: S3 Multi-Region Access Points (MRAP) provide a single endpoint for accessing buckets replicated across multiple AWS Regions, improving availability and latency for global applications. They do not improve throughput for training jobs in a single Region.
  • C is Incorrect: Adding EBS volume capacity does not speed up S3 data retrieval; the bottleneck is S3's per-prefix throughput, not local disk I/O. Caching data to EBS may help for subsequent epochs but doesn't solve the initial data loading bottleneck.
  • D is Incorrect: S3 Transfer Acceleration improves upload/download speeds over long distances (e.g., cross-region or on-premises), but here the data is in the same Region, so Transfer Acceleration won't improve throughput.
  • E is Incorrect: Setting AWS_REGION to us-east-1 when the bucket is in a different Region could cause data to travel cross-region, which could actually reduce throughput due to network latency and cross-region data transfer costs.

Key Takeaway: To achieve high throughput from S3, spread data across multiple random key prefixes—a single prefix (e.g., dataset_name/date/) can become a bottleneck limited to ~5,500 requests/sec per prefix.

Question 9 - EMRFS vs HDFS for Training Data Caching

A company trains large language models (LLMs) using Amazon EMR with Apache Spark MLlib. Training datasets are stored in Amazon S3 (Parquet format, 500 TB total). The EMR cluster uses 20 m5.24xlarge instances (10 TB local NVMe SSD each). The team currently uses EMRFS to read data directly from S3 during training.

Training jobs take 12 hours, with 4 hours spent on data loading. The team wants to reduce data loading time for multiple epochs by caching data locally, but they also want the flexibility to elastically scale the cluster up and down between jobs.

Which storage architecture should the team adopt?

  • A) Use HDFS on the EMR cluster's local NVMe SSDs for training data, and copy data from S3 to HDFS before each training job.
  • B) Use EMRFS with a consistent view, enabled by an external HDFS metadata server.
  • C) Use HDFS on the local NVMe SSDs for the first epoch, then switch to EMRFS for subsequent epochs.
  • D) Use Amazon EBS GP3 volumes (20 TB) for HDFS, instead of local NVMe SSDs.
  • E) Use EMRFS with a higher number of file system read threads and larger read buffers to maximize S3 read throughput.
Click to reveal Answer & Explanation

Correct Answer: A

Correct Option Analysis

  • A is Correct: For multi-epoch training jobs, caching data locally on the cluster nodes significantly reduces data loading time. HDFS on NVMe SSDs provides low-latency, high-throughput reads (up to several GB/s per node) compared to reading from S3 over the network (limited by S3 per-prefix throughput and network latency). Copying data from S3 to HDFS once before training (using s3-dist-cp or hadoop distcp) and then reading from HDFS for all epochs is the right pattern for iterative training workloads where the cluster is provisioned for the duration of the job.

Distractor Analysis

  • B is Incorrect: EMRFS consistent view is designed to provide consistent metadata when S3 objects are modified during processing. It does not cache data locally or improve read throughput.
  • C is Incorrect: Switching from HDFS to EMRFS mid-job would require re-reading data from S3, negating the cache benefit. HDFS should be used for all epochs if the data is already copied locally.
  • D is Incorrect: EBS GP3 volumes have lower I/O throughput compared to local NVMe SSDs and add additional cost and latency. Local NVMe SSDs are purpose-built for high-I/O, non-durable scratch storage.
  • E is Incorrect: Increasing EMRFS read threads and buffer sizes can help improve S3 read throughput but is still limited by S3's network bandwidth and per-prefix request limits. It won't approach the local storage throughput of NVMe SSDs.

Key Takeaway: For multi-epoch ML training, use HDFS on local NVMe SSDs to cache data and read locally—this eliminates S3 network overhead for repeated data access and drastically reduces training time.

Question 10 - OpenSearch Shard Size and Vector Query Performance

An AI company uses Amazon OpenSearch Service for semantic search over product documentation. The vector index stores embeddings in a 3-node cluster (each node has 64 GB RAM, 8 vCPUs). The index has 5 primary shards and 1 replica, totaling 10 shards. Each document contains a text field and a 1024-dimensional embedding.

The team notices that query latency has degraded over time as the index grew to 200 GB (10 million documents). The cluster's CPU utilization is 40%, and JVM memory pressure is 50%. The team wants to optimize query performance without adding nodes.

Which action should the team take?

  • A) Increase the number of primary shards from 5 to 20 and reindex the data.
  • B) Disable replicas to reduce the number of shards from 10 to 5.
  • C) Reduce the number of primary shards from 5 to 3 and reindex the data to keep shard size around 50 GB.
  • D) Increase the replica count from 1 to 3 for better query parallelism.
  • E) Switch the vector index engine from nmslib to faiss with HNSW for better memory usage.
Click to reveal Answer & Explanation

Correct Answer: C

Correct Option Analysis

  • C is Correct: 200 GB index with 5 primary shards means each shard is 40 GB. OpenSearch best practice is to target 30-50 GB per shard. As shards grow beyond 50 GB, query latency degrades because each shard becomes a heavier unit of work. Reducing primary shards from 5 to 3 would make each shard ~67 GB, which is still within acceptable range for 3 nodes. Wait—actually, let's re-read. 200 GB / 5 shards = 40 GB per shard, which is reasonable. The real issue is that with 5 primary shards and 1 replica, queries are distributed across all 5 primary (or replica) shards. The CPU is low (40%) and JVM pressure is 50%, so the cluster is not resource-constrained. The problem could be that the vector index is using nmslib with high memory overhead for 200 GB. However, reducing shards from 5 to 3 would increase shard size to 67 GB, which may not help. Hmm, let me reconsider. Actually, this is a poorly designed question. Let me correct it.

Revised Analysis: 200 GB / 5 primary shards = 40 GB per shard. This is acceptable. However, query latency is degrading because of the size of the faiss or nmslib index in memory. The 5 shards with 10 million documents mean 2 million documents per shard. For k-NN queries, OpenSearch uses approximate nearest neighbor (ANN) algorithms. The nmslib library can be slow when indexes grow beyond a few million vectors per shard. Reducing primary shards from 5 to 3 would increase shard size to 67 GB, which is larger, not smaller. This answer is actually incorrect. Let me re-evaluate.

Given the constraints (no adding nodes), the best approach is to reduce shard size to optimize query performance, but reducing the number of shards increases shard size. The correct answer should be A, increasing primary shards to 20, which would reduce shard size to 10 GB (200 GB / 20 shards). But 20 shards on 3 nodes exceeds the recommended shard-to-node ratio (2x shards per vCPU, so 8 vCPU = 16 shards per node, 3 nodes = 48 shards total). So 20 shards is acceptable.

Wait, let me reconsider the scenario. The team wants to improve performance without adding nodes. CPU and memory are not saturated. The issue is query latency. In OpenSearch, the number of shards affects query parallelism. With 5 primary shards, each query is executed against all 5 shards in parallel. If we increase to 20 primary shards, each query is executed against 20 shards, which increases parallelism but also overhead. However, the larger number of smaller shards allows OpenSearch to cache more data in memory (segment merging is more efficient) and reduces the amount of I/O per query.

Final Correct Answer: A

Distractor Analysis

  • B is Incorrect: Disabling replicas reduces fault tolerance and may reduce query parallelism if search_type is set to use replicas. It does not reduce shard size, which is the root cause.
  • C is Incorrect: Reducing shards to 3 increases shard size to 67 GB per shard, which is above the recommended 50 GB upper limit and would likely worsen performance.
  • D is Incorrect: More replicas add more parallel query capacity but don't reduce shard size. With 1 replica, the cluster already has 10 shards (5 primary + 5 replica) to spread query load.
  • E is Incorrect: Switching from nmslib to faiss (HNSW) is an implementation change that may or may not improve memory usage. Both libraries are supported and performant, and the choice depends on specific workload patterns. It's not the most direct solution given the shard size issue.

Key Takeaway: OpenSearch query performance degrades when shards exceed ~50 GB; increasing shard count (up to 2x shards per vCPU per node) reduces shard size and improves query latency by enabling more parallel work and efficient segment merging.

Note: Final answer for Question 10 is A (increase primary shards from 5 to 20). The explanation above reflects this.

Click to reveal Answer & Explanation

Correct Answer: A

Correct Option Analysis

  • A is Correct: OpenSearch query latency degrades as shard size grows beyond the recommended 30-50 GB range. With 200 GB and 5 primary shards, each shard is 40 GB, which is near the upper bound. Increasing primary shards to 20 reduces shard size to 10 GB, enabling finer-grained query parallelism and more efficient segment merging. The cluster has capacity (CPU 40%, JVM 50%) to handle more shards, and 20 shards × 2 replicas = 40 shards total, within the 3-node cluster's capacity.

Distractor Analysis

  • B is Incorrect: Disabling replicas reduces fault tolerance and read throughput, without addressing shard size. The bottleneck is shard size, not replica count.
  • C is Incorrect: Reducing shard count to 3 increases shard size to 67 GB, worsening the query latency issue by exceeding the recommended 50 GB per shard limit.
  • D is Incorrect: Adding more replicas improves read throughput but doesn't reduce shard size. More replicas also increase cluster storage overhead and cross-node replication traffic.
  • E is Incorrect: Switching from nmslib to faiss (HNSW) changes the ANN library but may not yield significant performance gains without addressing the fundamental shard size issue. Both libraries are highly optimized.

Key Takeaway: Maintain OpenSearch shard size between 30-50 GB; when query latency degrades due to shard growth, increase shard count (while staying within 2x shards per vCPU per node) to reduce per-shard overhead.