# Topic covered
* System Design Introduction
* Client - Server Architecture
* Monolith & Microservices
* gRPC
* Network Protocols
* Proxies

1.1 System Design Introduction

System Design is the process of identifying, creating, and designing systems that meet a company’s or organization’s specific objectives and expectations.

Systems design is about system’s analysis, architectural patterns, APIs, design patterns, and gluing it all together

  • It includes some objectives like:
    • Low costs and maintenance efforts
    • Performance, Scalability
    • Latency, Throughput
    • Availability, Consistency

Components of System Design

  • Logical Entities
    • Data
    • Databases
    • Cache
  • Tangible Entities(Technology)
    • Text, Video, images
    • MySql, MongoDB
    • Redis, MemeCache

1.2 Client-Server Architecture

Depending on where the presentation, logic and data resides, system architecture can be divided as follows:

1-Tier Architecture or Single Tier

It is the simplest one as it is equivalent to running the application on the personal computer.

All the required components for an application to ``run are on a single server.

Presentation layer, Business logic layer, and data layer are all located on a single machine.

2-Tier Architecture

It is like Client-Server architecture, where communication takes place between client and server.

In this type of software architecture, the presentation layer or user interface layer runs on the client side while dataset layer gets executed and stored on server side.

3-Tier Architecture

App is partitioned into 3 logical components

Client machine communicates with App server, and App server communicated with DB system to access data.

Types of clients

  • Thin Client
    • Less processing is done on client side
    • E-Commerce sites, Streaming applications
  • Thick Client
    • High processing is done on client side
    • Gaming Apps, Video editing software

1.3 Monolith & Microservices

https://www.atlassian.com/microservices/microservices-architecture/microservices-vs-monolith

A monolithic application is built as a single unified unit while a microservices architecture is a collection of smaller, independently deployable services.

https://www.primevideotech.com/video-streaming/scaling-up-the-prime-video-audio-video-monitoring-service-and-reducing-costs-by-90

https://www.youtube.com/watch?v=xflakXiwkD0

Monolithic

  • Pros
    • Easy development: When an application is built with one code base, it is easier to develop
    • Easy deployment: One executable file or directory makes deployment easier.
    • Easy debugging: With all code located in one place, it’s easier to follow a request and find an issue.
  • Cons:
    • Scalability issue - can’t scale individual components
    • Deployment: Small changes, redeployment of the entire monolith
    • Reliability: An error in any module, it could affect the entire application

Microservices

  • Pros
    • High reliability
    • Continuous deployment
    • Flexible scaling
  • Cons
    • Exponential infrastructure costs

1.4 gRPC

RPC: https://www.geeksforgeeks.org/remote-procedure-call-rpc-in-operating-system/

gRPC: https://www.freecodecamp.org/news/what-is-grpc-protocol-buffers-stream-architecture/

Local Procedure Call is a procedure call which occurs within a process and on the same system.

Remote Procedure Call enable one machine to invoke some code on another machine,

gRPC is an popular implementation of RPC. gRPC is an open-source Remote Procedure call created in 2016, It was an re-write of RPC

It has been adopted by many organization like Google, Netflix, Cisco to connect large number of microservices running within and distributed data-centers.

  • Cross-support in many programming languages
  • Has high performance - it used HTTP/2 protocol

1.5 Network Protocols

https://www.cloudflare.com/learning/network-layer/what-is-a-protocol/

A network protocol is a set of rules that determine how data is transmitted between different devices in the same network. Network protocols enable devices to communicate with each other regardless of their internal processes, structure or design.

There are different types of network protocols for different purposes, such as TCP, UDP, HTTP, HTTPS, TLS/SSL, FTP, SMTP, etc.

/tags/protocols – read more

1.6 Proxies

https://www.jscape.com/blog/forward-proxy-vs-reverse-proxy

https://developer.mozilla.org/en-US/docs/Web/HTTP/Proxy_servers_and_tunneling

A proxy server is an intermediary piece of hardware/software sitting between the client and the server. The main purpose of a proxy service is to act on behalf of another machine the proxy acts as a middleman.

  • Proxy Server Types
    • Forward proxies
    • Reverse proxies

Forward vs Reverse proxy

Forward proxy

A forward proxy is a machine that sits between client and server but towards the client. This proxy machine talks to the server on behave of client.

When a client make requests a sites/services, the proxy server intercepts those requests and then communicates with web servers on behalf of those clients, like a middleman.

It ensures that no origin server ever communicates directly with that specific client. Forward proxy, often called a proxy, proxy server, or web proxy

Forward proxy is commonly used for:

  • Protect clients
  • Avoid browsing restrictions
  • Block access to certain content

Example

Tor Browser routes internet traffic through multiple proxies for anonymity.

Proxy firewall: Some governments, schools, and other organizations use firewalls to give their users access to a limited version of the Internet.

Reverse proxy

A reverse proxy is a machine that sits between client and server but towards the server side. This proxy machine talks to the client on behave of server.

When clients send requests to the origin server of a website, those requests are intercepted at the network edge by the reverse proxy server. The reverse proxy server will then send requests and receive responses from the origin server. The responses are then sent to the client as if the proxy server had processed the request.

It ensures that no client ever communicates directly with that origin server.

Common uses for a reverse proxy server include:

  • Load balancing
  • Security and anonymity
    • Encrypt and decrypt SSL communications
    • Protects server identities
  • Web acceleration
    • Cache static contents

Example

NGINX: NGINX is a popular open-source web server that can also function as a reverse proxy, load balancer, and HTTP cache.