Estimating Storage and Bandwidth
Storage estimation is a rough calculation of how much data a system must keep. Bandwidth is the amount of data that moves through a system in a given time.
Storage for five million users
Each printed line below is one step in the storage chain.
users = 5000000
kb_each = 100
total_kb = users * kb_each
total_mb = total_kb // 1000
total_gb = total_mb // 1000
print("Users:", users)
print("KB for each user:", kb_each)
print("Total KB:", total_kb)
print("Total MB:", total_mb)
print("Total GB:", total_gb)Data out each second
Each printed line below is one step in the bandwidth chain.
requests_per_second = 1157
kb_per_response = 10
kb_out = requests_per_second * kb_per_response
mb_out = kb_out / 1000
print("Requests per second:", requests_per_second)
print("KB per response:", kb_per_response)
print("KB out per second:", kb_out)
print("MB out per second:", round(mb_out, 1))Example
users = 5000000
kb_each = 100
total_kb = users * kb_each
print("Step 1 - total KB kept:", total_kb)
print("Step 2 - total GB kept:", total_kb // 1000 // 1000)
requests_per_second = 1157
kb_per_response = 10
kb_out = requests_per_second * kb_per_response
print("Step 3 - KB out per second:", kb_out)
print("Step 4 - MB out per second:", round(kb_out / 1000, 1))Key points
- Design units: 1 KB is 1,000 bytes, 1 MB is 1,000 KB, and 1 GB is 1,000 MB.
- Stored total: multiply the number of items by the size of each item.
- Data out: multiply requests per second by the size of each response.
- Worked storage: 5,000,000 users keeping 100 KB each need 500 GB in total.
- Worked bandwidth: 1,157 requests per second with 10 KB in each response move about 11.6 MB out each second.
In this example, the first chain multiplies a count by a size to get data kept. The second chain multiplies a rate by a size to get data moving.
Note
these totals are rough planning figures, not exact measures of a real system.
Try it Yourself
Edit the code, then press Run.
Running is simulated
Exercise
5,000,000 users each keep 100 KB of data. About how much storage is that in total?