5 steps approach:
- Use Cases Generation: Gather all the possible use cases.
- Constraints and Analysis: How many users, how much data, etc...
- Basic design: Few users case.
- Bottlenecks: Find the bottlenecks and solve them.
- Scalability: Large number of users.
ELB - elastic load balancer
- Deployed when a site need multiple servers due to volume of requests. Can do health checks.
- L4 transport layer (TCP) load balencer
- L4 makes routing decisions based on the first few packets in the TCP stream, and do not inspect packet content.
- Usually use a simple algorithm like round robin, least loaded with slow start, latency, weighted round robin, etc.
- pros: better granularity, simple and responsive, requires less computation.
L 7 application layer (HTTP) load balancer
L7 makes routing decisions based on HTTP header and the actual contents of the message, such as URL, type(text, video, graphics), or cookie.
Requires more time and computing power.
Requests for static assets can be routed to servers that is optimized to serve media content.
Reverse Proxy - a website's "public face". (nginx, apache)
- sits at the edge of the site's network to accept requests.
- pros:
- security: backend servers are not exposed, can reject malicious traffic.
- scalability: client only see the reverse proxy's IP address, the backend can be load balanced dynamiclly.
- Web acceleration: Can compress responses, handle SSL encrypt and decryption. Cache request.
(Frontend) Web Tier - where web pages are served.
- Stateless - allows frontend web tier to add or remove hosts and achieve horizontal scalability.
- Web App and API
- MVC or MVVC are the dominant pattern for this layer.
- Model: a collection of classes that explains business logic and data model.
- View: UI components like HTML/CSS
- Controler: Takes user inputs from the view, process the data from the model and return the results to the view.
- MVC or MVVC are the dominant pattern for this layer.