Premise:- Urbanclap’s effort to provide professionals with a platform to showcase their work in form of images has exploded the media we handle in the recent past. We have about 14 million images as of now(and growing with a rate of approx. 10 percent monthly). Apparently, there were many cases of plagiarism that were being reported by professionals themselves, leading to a burgeoning demand of an automated system that could detect similar images as and when they are added. What was required was a foundation of a solution that could effectively detect duplicates with an algorithm that fits the constraints…


This blog is a continuation of my previous blog and answers some of the important questions left open ended. I shall strongly advice to go through my previous blog `Pessimistic Locking for a distributed System (Part-1)` to have a clear context.

Lets answer each and every question I wrote about in my previous blog

  1. How do we eliminate starvation?

Now, while working with exclusive locks no one can guarantee that there will be no starvation, unless he/she enables some sort of preemption or timeouts. And thats what we are exactly going to do. We can enable timeouts for our transaction…


Motivation

There are a lot of use cases that require an exclusive access to a resource. In a distributed system, with several containers running the same piece of code in parallel, achieving consensus among all the containers gets quite convoluted. This entails intervention of a centralised locking mechanism controlled by a single entity deciding which processes uses the required piece of code exclusively at a time. Customisations as to who can access this piece of code in parallel and who cannot, with minimal starvation and without loss of consistency at any given point, is an added requirement.

Use Cases

  1. synchronisation where we are…

Sankalp Singh

Software Engineer, Urbanclap Technologies

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store