Minimizing Infrastructure Operations Overhead for Image Upload Feature in a Social Media Application

Optimizing Infrastructure for Image Upload Feature

Question

You are working on a social media application.

You plan to add a feature that allows users to upload images.

These images will be 2 MB "" 1 GB in size.

You want to minimize their infrastructure operations overhead for this feature.

What should you do?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

B.

https://cloud.google.com/blog/products/storage-data-transfer/uploading-images-directly-to-cloud-storage-by-using-signed-url

The best solution to minimize infrastructure operations overhead while allowing users to upload images on a social media application is to use Cloud Storage and signed URLs. Therefore, option B is the correct choice.

Option A is not a recommended solution because storing images in the database that stores other user information can result in slow response times, high storage costs, and limited scalability. Moreover, storing large files like images in databases can cause performance issues.

Option C is not an ideal solution because managing a custom file store requires additional infrastructure and operational overhead. The application must also retrieve the images from the file store, which can affect response times and scalability.

Option D is not a recommended solution because creating a separate bucket for each user can result in high storage costs, limited scalability, and complex access control policies. Additionally, transferring service account credentials to the client application based on user information can pose security risks.

Using Cloud Storage and signed URLs is the best solution because it provides scalability, security, and low operational overhead. By using signed URLs, users can upload images directly to Cloud Storage without the need for additional infrastructure, like a web server. Signed URLs also provide time-limited access to Cloud Storage, which reduces security risks.

To implement this solution, the application should generate a signed URL for each image upload request. The signed URL should contain the necessary authentication information and an expiration time. The application should then send the signed URL to the client application, which can use it to upload the image directly to Cloud Storage.

Once the image is uploaded, the application can retrieve it from Cloud Storage using the appropriate storage bucket and file path. This approach provides high scalability, low operational overhead, and secure access to uploaded images.