12 Design Flickr

 

This chapter covers

  • Selecting storage services based on non-functional requirements
  • Minimizing access to critical services
  • Utilizing sagas for asynchronous processes

In this chapter, we design an image sharing service like Flickr. Besides sharing files/images, users can also append metadata to files and other users, such as access control, comments, or favorites.

Sharing and interacting with images and video are basic functionalities in virtually every social application and is a common interview topic. In this chapter, we discuss a distributed system design for image-sharing and interaction among a billion users, including both manual and programmatic users. We will see that there is much more than simply attaching a CDN. We will discuss how to design the system for scalable preprocessing operations that need to be done on uploaded content before they are ready for download.

12.1 User stories and functional requirements

Let’s discuss user stories with the interviewer and scribble them down:

12.2 Non-functional requirements

12.3 High-level architecture

12.4 SQL schema

12.5 Organizing directories and files on the CDN

12.6 Uploading a photo

12.6.1 Generate thumbnails on the client

12.6.2 Generate thumbnails on the backend

12.6.3 Implementing both server-side and client-side generation

12.7 Downloading images and data

12.7.1 Downloading pages of thumbnails

12.8 Monitoring and alerting

12.9 Some other services

12.9.1 Premium features

12.9.2 Payments and taxes service

12.9.3 Censorship/content moderation

12.9.4 Advertising

12.9.5 Personalization

12.10 Other possible discussion topics

Summary