Welcome to ajhawrites.blogspot.com, the go-to source for all things Tech, Product, People and Process. This blog features a wide range of articles, news, and insights on the latest advancements in technology, including topics such as artificial intelligence, cybersecurity, software development, emerging technologies, and more. Also, articles about product, people and process.
Monday, April 24, 2023
Scaling lessons from building BBDaily.com(Bigbasket.com) and shiskha.com?
Sunday, April 16, 2023
Application/Platform cost optimization's series - Part Two
In my last post about the cost optimization, we discussed a few approaches. Here is the link: http://bitly.ws/D6Pc
In this post, we will look deep into one of the famous cost estimation technique called as "The Back-of-envelope calculations".
Every modern day system what we design these days have majorly following components:
1. Applications -> You run on VMs or any cluster like GKE
2. Databases -> SQL, NoSQL etc..
2. Cache layer -> Redis, Memcached etc..
4. Message Queues -> Kafka, Google Pub/Sub etc..
5. Networking layer
So how do we do these estimates? What are the prerequisites?
Let's start with the basic refreshers.
Remember this "BKMGTP", this will be used for data size estimations.
B: Byte : Ten: 10
K : Kilo : Thousand : 1000 - > 2^10
M: Mega: Million: 1000 0000 ->2^20
G: Giga: Billion: 1000 000 000 ->2^30
T: Tera: Trillion: 1000 000 000 000 ->2^40
P: Peta: Quadrillion: 1000 000 000 000 000->2^50
Latency numbers:
ms -> 10^-3 seconds
1µs -> 10^-6 seconds
1ns -> 10^-9 seconds
L1 cache reference -> .5 ns
Branch mispredict -> 5 ns
L2 cache reference -> 7 ns
Mutex lock/unlock -> 100 ns
Main memory reference -> 100 ns
Compress 1k bytes with Zippy -> 10 µs
Send 2kb over 1 Gbps network -> 20 µs
Read 1 MB sequentially from memory -> 250 µs
Round trip within the same data center -> 500 µs
Disk seek -> 10ms
Read 1 MB sequentially from the network -> 10 ms
Read 1 MB sequentially from disk -> 30 ms
We will discuss in the next post about the component wise estimation, in the meantime, please refresh above details.
Happy learning :)
References:
Application/Platform cost optimization's series - Part one
In the current market scenarios, optimization word is very popular.
We can think about optimising our applications to reduce the cost. Usually, everyone likes to build cool products and move on. Maintaining product is not an exciting job, at times it is boring and it takes a lot of hard work.
So, how do we do it?
The solution lies in setting up the right process during the application design and development.
1. Have a predefined cost estimation template as a part of the design.
Part 2: https://rb.gy/ch6hz
LocalBaniya: Giving Every Small Shop in India a Digital Identity
LocalBaniya: Giving Every Small Shop in India a Digital Identity More: Localbaniya.shop
-
Let's finish this post with an example of "Back-Of-The-Envelope Calculation or Fermi problems", this is a useful technique w...
-
In my last post about the cost optimization, we discussed a few approaches. Here is the link: http://bitly.ws/D6Pc In this post, we will lo...
-
Today, I am going to discuss about the self vs team's visibility. I hope most of you would have seen this Bollywood movie "Gangaaja...
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