Lesson 5 of 5 ML Data Sources, Storage and Formats

Troubleshooting Ingestion and Storage Capacity Limits

This lesson explains how to recognise the symptom of each capacity limit in stores, streams and the network, which is the key to fixing ingestion pipelines and training jobs that slow down or fail.

Learning outcomes

After completing this lesson, you will be able to:

  • Spread S3 requests across prefixes.
  • Choose between File, FastFile and Pipe input modes for data-starved training jobs.
  • Diagnose stream, database and disk capacity limits.

S3 request rates

Amazon S3 supports at least 3,500 PUT, COPY, POST or DELETE requests and 5,500 GET or HEAD requests per second for each prefix, and scales further by partitioning prefixes automatically. A sudden burst against a single prefix can return HTTP 503 Slow Down while S3 adjusts. The fixes are to spread objects across more prefixes, retry with exponential backoff (the AWS SDKs do this automatically) and avoid writing millions of tiny objects.

Training jobs starved of data

A training job that shows low GPU utilisation while its instances are busy reading data is I/O-bound. SageMaker AI offers three input modes. File mode downloads the whole dataset to the instance's EBS volume before training starts, so large datasets delay the start and need a large volume. FastFile mode presents S3 objects as files and streams them on demand, so training starts immediately. Pipe mode streams data through Unix pipes for algorithms that support it.

Further fixes are to combine many small files into larger shards (100 MB to 1 GB), to use FSx for Lustre for repeated high-throughput reads and to increase the data loader's parallel workers. The following table summarises the input options.

OptionHow it worksUse when
File modeCopies the full dataset to EBS before trainingSmall datasets, random access needed
FastFile modeStreams S3 objects on demand as filesLarge datasets, sequential reads
Pipe modeStreams through a pipeSupported built-in algorithms, RecordIO
FSx for LustreParallel file system linked to S3Many instances, many epochs, highest throughput
Amazon EFSShared NFS mountData already on EFS

The following diagram compares an image training job that reads 40 million small files in File mode with the same job after the images are sharded and served through FSx for Lustre.

The image training job before and after. In File mode, each of eight nodes copies all 4 TB of 100 KB JPEGs before the first epoch, a two-hour wait, and then GPUs sit at about 30% because of per-file overhead. With the images packed into 256 MB shards spread across prefixes and an FSx for Lustre file system linked to the bucket, training starts at once and GPUs stay busy.
The run lengths are illustrative.
Troubleshooting scenario

Starved training jobs

Exam skills 1.1.3

Fix the data loading problems of a training job, one at a time.

Log in to try this activity Interactive activities are free with an account.

Streams, databases and disks

Kinesis Data Streams returns ProvisionedThroughputExceededException when a shard receives more than 1 MB or 1,000 records per second. If total capacity is sufficient, the partition key is concentrating traffic on a hot shard. DynamoDB throttles when a partition or the table exceeds its capacity; on-demand mode or better-distributed keys fix this. A training instance whose EBS volume is too small for File mode fails with a no-space error, fixed by a larger VolumeSizeInGB or a streaming input mode.

Match the pairs

Read the capacity error

Exam skills 1.1.3

Match each capacity symptom with the change that fixes it.

Log in to try this activity Interactive activities are free with an account.
Worked example

A slow image training job

An image classification job reads 40 million JPEG files (about 100 KB each) from S3 in File mode on eight GPU instances. Each run waits two hours before the first epoch, and GPU utilisation stays near 30%. Each symptom points to a different cause, as the following table shows.

SymptomCauseFix
Two-hour wait before training startsFile mode copies all 4 TB to each nodeFastFile mode or FSx for Lustre
GPU utilisation around 30%Per-file overhead of tiny objectsPack images into shards of about 256 MB
Occasional 503 Slow Down errorsBurst reads on one prefixSpread shards across prefixes and retry with backoff

Packing images into shards and linking an FSx for Lustre file system to the bucket removes both the start-up delay and the per-file overhead. Simply choosing larger GPU instances would raise cost without fixing the bottleneck.

Check yourself

What does a 503 Slow Down error from S3 mean, and how is it fixed?

Show answer

The request rate on a prefix is too high. Spread objects across more prefixes and retry with backoff.

Exam Tips

Remember for the exam

  • 503 Slow Down: spread prefixes and retry with backoff.
  • Long start-up for large datasets: FastFile mode instead of File mode.
  • Low GPU utilisation with many small files: shard files or use FSx for Lustre.
  • Kinesis throttling with spare capacity: hot partition key.
  • No space left during File mode: increase the volume size or stream the data.