Lesson 4 of 6
Lesson 4 — Storage, Databases and Scaling
Object vs block vs file, SQL vs NoSQL, and why 'just add another server' is harder than it sounds.
Learn it
Object storage holds files like photos and videos, addressed by a key — cheap and effectively unlimited.
Block storage is a virtual hard disk attached to one machine; file storage is a shared network drive.
Scaling up means a bigger machine; scaling out means more machines behind a load balancer.
Key terms
- Object storage
- Key-addressed blob storage over HTTP, e.g. Amazon S3.
- Load balancer
- Distributes incoming requests across many healthy servers.
- Stateless
- A server keeps no per-user data locally, so any instance can serve any request.
- Read replica
- A copy of a database that serves read queries to reduce load on the primary.
- Eventual consistency
- Replicas agree after a short delay rather than instantly.
Fix a site that falls over at 5,000 users
Every page load hits the database 40 times and uploads save to the local disk.
- 1Step 1: Move uploads to object storage — now servers are interchangeable.
- 2Step 2: Put sessions in a shared cache so logins survive a server restart.
- 3Step 3: Add a CDN for images and CSS — most requests never reach your servers.
- 4Step 4: Add read replicas and cache hot queries; only then consider sharding.
Uploading to object storage
pythonimport boto3
s3 = boto3.client('s3')
s3.upload_file(
'report.pdf', # local file
'school-results-2026', # bucket
'reports/term1/report.pdf' # key
)
url = s3.generate_presigned_url(
'get_object',
Params={'Bucket': 'school-results-2026', 'Key': 'reports/term1/report.pdf'},
ExpiresIn=300 # link dies after 5 minutes
)The bucket stays private; a presigned URL grants time-limited access to one object. That's how 'share this file' buttons work safely.
Sandbox lab
Practise the real technique in a fully simulated environment — no live systems, no real data, nothing leaves your browser.
Cloud cost simulator
Architect the stack, then get graded on cost, performance, reliability and waste.
A mostly-static school website. Traffic is small and steady, images are read constantly, budget is tight.
Storage class
Compute
Scaling strategy
Database
Try it
Two servers sit behind a load balancer. Sessions are stored in each server's memory. What does the user experience?
textRequest 1 -> Server A (login OK, session saved in A's RAM)
Request 2 -> Server B (session lookup...)Challenge
A photo-sharing app stores uploads on the web server's disk and thumbnails are generated on request. Redesign it for the cloud and justify each change.
Pick whichever way suits you — every mode earns the same bonus XP.
Write at least 40 more characters to submit.
Mark your own work
Guided walkthrough — 0/5 clues revealed
- Clue 1 locked — reveal it only if you get stuck.
- Clue 2 locked — reveal it only if you get stuck.
- Clue 3 locked — reveal it only if you get stuck.
- Clue 4 locked — reveal it only if you get stuck.
- Clue 5 locked — reveal it only if you get stuck.
Each clue costs 5 XP (never below 22 XP). You'd earn 43 XP right now.