System Design -Design a system to upload images with tags

Kavit (zenwraight)
2 min readJun 28, 2019

--

Before jumping into designing the system from the problem statement given to us. Let us take a step back and think about what all information we will need to store on our side.

  1. Store raw images (we would have to store images on a server).
  2. Store tags associated to images.

Now before moving on with the service designs, we should also think about scale. Like how do we make our system scalable so that we could extend it to cater needs for 10’s or 1000’s of users.

The first thing that comes to our mind when we bring the term scalable is, we need a distributed system.

Let’s have two different services for our two simple requirements mentioned above.

  1. Distributed files system that will store the actual images. For example Hadoop, Google’s file system (proprietary), S3 e.t.c
  2. Nosql searchable store. Key are the tags. Value is path for image. For example Elastic or Solr. Uploading is practically adding to Elastic a json, having tags in indexable field and Hadoop’s path in other field.

Now we will be supporting two API endpoints for user.

  1. POST endpoint /save/image, which get the image and a list of tags along with it and we will be storing the image and insert the image url into all the json where the tag is our key.
  2. GET endpoint /get/images, which will take a tag keyword and will return back with the list of image urls present in the tag.

I am attaching a diagram to show how our distributed system will look like. The diagram only contains one node of our Image Processing Service but we scale it up to n numbers and load balancer would take care of the concurrent requests coming in from the users.

Hope you like the article !

--

--

Kavit (zenwraight)
Kavit (zenwraight)

Responses (3)