Optimal Performance with Object Keys for AWS S3 Hosting

Best Object Key Structure for AWS S3 Performance

Prev Question Next Question

Question

Your company is planning to use the Simple Storage Service to host objects that users will access.

You need to store the photos based on the date and you also need the folder structure to be concise.

There is a speculation that there would be roughly 6000 GET requests per second.

Which of the following is the right way to use object keys for optimal performance?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

Answer - C.

According to the latest AWS documentation, randomizing prefix naming is not required to improve S3 performance.

"For example, previously Amazon S3 performance guidelines recommended randomizing prefix naming with hashed characters to optimize performance for frequent data retrievals.

You no longer have to randomize prefix naming for performance and can use sequential date-based naming for your prefixes."

Option A is incorrect because there is no need to use a subfolder of photo1.

Option B is incorrect because there is no need to use a subfolder of sample.

It needs subfolders based on the date.

Option D is incorrect because it does not store the photos based on the date.

For more details, please check below AWS Docs: https://docs.aws.amazon.com/AmazonS3/latest/dev/optimizing-performance.html.

The correct answer is C: exampleawsbucket/2019-14-03-15-00-00/photo1.jpg.

Explanation: When storing objects in Amazon S3, it is recommended to use a flat structure for the object key names. This helps in better performance, and efficient management of the objects in the bucket. Using a folder structure or hierarchical structure with many levels can cause performance degradation, especially when you have a large number of objects in the bucket.

Option A: exampleawsbucket/photo1/2019-14-03-15-00-00/photo1.jpg is not the best approach as it uses a hierarchical structure, with multiple levels of folders. This can lead to performance issues when you have a large number of objects in the bucket.

Option B: exampleawsbucket/sample/2019-14-03-15-00-00photo1.jpg is not recommended as it does not have a clear separation between the date and the name of the photo. This can make it difficult to manage and query the objects in the bucket.

Option C: exampleawsbucket/2019-14-03-15-00-00/photo1.jpg is the best option as it uses a flat structure, with the date and photo name clearly separated. This makes it easier to manage and query the objects in the bucket.

Option D: exampleawsbucket/sample/photo1.jpg is not recommended as it does not provide any information about the date of the photo. This can make it difficult to organize and query the objects based on the date.

Regarding the expected 6000 GET requests per second, S3 can handle much higher traffic than that without any issues. So, there is no need to worry about performance in this scenario.