Sunday, April 16, 2023

Application/Platform cost optimization's series - Part Three

Let's finish this post with an example of "Back-Of-The-Envelope Calculation or Fermi problems", this is a useful technique while you are building a new platform from scratch or scaling out your existing platform.


Example: Let's say you want to build a photo-sharing app, below are the high-level features:


1. User should be able to register with the app
2. Upload a photo/photos
3. Get a sharable link after the photo is uploaded
4. User should be able to view/browse through the uploaded photos

Non-functional requirement(assumptions):
1. No of active users/month ~ 1M
2. Average photo upload/day ~10 photos
3. Total new users/day ~ 1k
4. Average photo size ~2MB

Based on the above nos, let's do some calculations for the user and their photos data.

N = no of years you want to hold the data

1. Let's say the average user profile size (basic details and profile image) is 1MB. The total data size of profile DB = N*1000*365*1MB = N*365GB
2. Photos storage requirements: N*10*33000*365*2MB = N*.25TB
3. Let's say you want to replicate the data to m no of replicas

So the total data storage requirement would be:
Profile DB size ~ m*N*365GB
Photos DB size ~ m*N*.25TB

Similarly, we can do the calculation for the no of read-to-write requests (QPS) and provision our server based on that.

Previous post link(just to connect the dot): http://bitly.ws/D6P2

Happy weekend 

No comments:

Post a Comment

Common Code Smells and Heuristics - Final Part

  https://ajhawrites.medium.com/common-code-smells-and-heuristics-final-part-6391a095fd5f This is the final part of the learnings from “Clea...