Web Scalability for Startup Engineers

By Artur Ejsmont (2015)

My Notes

Typical scalability journey:

💡 Different systems will have different needs (bottlenecks will appear in different places).

Vertical Scalability

Upgrade the infrastructure.

Horizontal Scalability

Spread the workload logically.

… let’s think of it as running each component on multiple servers and being able to add more servers whenever necessary.

Horizontal Scalability Strategies

Delegate Work

Use REST, make sure GET requests have no side-effects and are constant over time (not: shopping carts, pages that require authorisation). Caches can affect analytics.

Reduce the Workload

Spread the Workload

NoSQL

Origins in distributed stores. Because ACID has problems in distributed stores, they sacrifice parts.

Term Definition
Atomicity Transaction done or not
Consistency Only valid data is saved
Isolation Transactions don’t affect others
Durability Written data not lost

Caching

The higher the better (less work arrives at the lower layers).

Cache Location Savings
Client 100%
CDN 98%
Reverse proxy 66-98%
Server 50-75%

Where to apply caching? Measure! Rank each page/endpoint by,

Time to serve response × number of requests made

Speed Comparison

Operation Time (ns) Multiplier
Memory access 100 ×1
Disk seek (SSD) 100,000 ×1,000
Packet round trip (same data centre) 500,000 ×5,000
Disk seek (non-SSD) 10,000,000 ×100,000
Read 1MB sequentially from network 10,000,000 ×100,000
Read 1MB sequentially from non-SSD 30,000,000 ×300,000
Packet round trip (across Atlantic) 150,000,000 ×1,500,000