TCP/OSI Model
- This model uses layers to help give a visual description of what is going on with a particular networking system
- OSI Model

- Each Layer has funcationalities
- Layer 1: Physical: This layer defines the logic levels, data rate, physical media & data conversion functions
- Layer 2: Data link: Package & Unpackage the data in frames
- Layer 3: Network: This network layer handles packet routing and switching
- Layer 4: transport: This layer provides the quality of service functions. TCP is part
- Layer 5: Session: This layer handles authentications & authorization
- Layer 6: Presentation Layer: This layer checks the data & it can handle encryptions & decryptions
- Layer 7: This layer used communication protocols like http, IMAP, SMTP.
- When we speak of cloud we use tcp/http(s), So we need to worry about Layer 4 & layer 7
- Transport Layer Protocols
- TCP
- UDP
- Port is defined at the Transport Layer (Layer 4)
Multiple Servers to Handle Load
-
As the load increase on web/application servers we can solve the issue
- By increasing RAM/CPU (Vertical Scaling)
- By increasing servers and sharing load b/w them (Horizontal scaling)
-
Most of the organizations prefer Horizontal scaling especially in cloud
-
Since the multiple servers are involved, we would add a load balancer and use that as an interface to our multiple servers

-
There are two types of load balancers
- Software Load balancers
- Hardware Load balancers
-
Load balancer whenever a client sends a traffic to which server should i forward?

-
To solve this load balancers have load balancing algorithms
- Round-Robin: Requests are evenly distributed across servers sequentially
- Least Connections: A new request is sent to the server which has fewest connections at that moment
- Least time: Sends the request to server which has the fastest response time
- Sticky Sessions: Sends the request to the same server that client was given last time
- Hash: Define a key such as client IP address or request url to send to a particular server
- Random:
-
Load balancing can happen at two layers
- Layer 4
- Layer 7

-
In Layer 4 loadbalancing, Load balancing can be done by redirecting the traffic recieved on a particular port of loadbalancer (source port) to particular port of connected servers (target port)

-
Layer 7 loadbalancing

Domain Names and DNS Servers
-
Generally we access the serves with names. There are two kinds of names depending on purpose
- public: https://google.com, https://swiggy.com
- private: https://qt.internal.com
-
DNS is used to give names. It is like the phonebook (Telephone directory) of internet.
-
When i type google.com there will be some server which is hosting google.com and all communication protocols commmunicate mostly using ipaddresses not names.
-
So when i type name how does it gets converted to an IP Address, For this DNS Servers are maintained.
-
DNS server will store
- records mapping name to ip address
-
Generally organization for their internal names use internal dns servers and websites use public dns servers.

-
To store these Mapping DNS servers have different record types
- A record: This record holds the ip address of domain

- CNAME Record: Forwards one domain name to other
fb.com- MX record: Directs mail to email server
- TXT record: lets admin store text in the records
- NS Record: Stores the name server for DNS entry

- A record: This record holds the ip address of domain
-
If it is private names for your network purpose we need to maintain dns entries
-
If it is for public website, we have Domain Name Sellers and hosting services like GoDaddy, AWS, Azure
