Skip to content

This Go-based URL shortener implements a microservice architecture leveraging gRPC for inter-service communication, PostgreSQL for persistent storage, and Redis for caching, employing mutexes for concurrency control to ensure data integrity during high-volume access. It provides endpoints for URL shortening, resolution, and access count retrieval.

Notifications You must be signed in to change notification settings

kasyap1234/url-shortner-microservice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

url-shortner-microservice

using sync mutex to prevent race condition

eg : imagine two requests for the same url example.com via 2 goroutines , assume count of url =0;

first goroutine will increment the counter by 1 ; updated count =1; second goroutine will also increment the counter by 1 ; updated count=1; without mutext , we will get udpdated count=1; because the second goroutine will also read the same initial value of count=0;

defer statements are eecuted when the function returns ; Screenshot from 2024-12-18 12-43-08 Screenshot from 2024-12-18 12-42-54

About

This Go-based URL shortener implements a microservice architecture leveraging gRPC for inter-service communication, PostgreSQL for persistent storage, and Redis for caching, employing mutexes for concurrency control to ensure data integrity during high-volume access. It provides endpoints for URL shortening, resolution, and access count retrieval.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages