Transmission Delay – The time taken for host to put the entire packet in the line is transmission delay. If the first bit of the packet on the the line at time t1 and the last bit of the packet is put on the line at time t2, so the transmission delay of the packet is (t2 – t1). We define transmission delay as Tt = L/B (L = Length of packet, B = Bandwidth) Notation Data
Propagation Delay – The time taken for a bit to travel from source to destination is propagation delay. Tp = d/v (d = Distance of host to destination, v = velocity of the packet)
Queuing delay – Packets are received in the receiver and sit in a queue until all packet come it is called queuing delay.
Processing Delay – Packets are taken from the queue and taken to the processor for processing that is called processing delay.
Sometime wile sending data from sender to receiver the other end there may be queue is full in that case the later packets will be discarded for that we use stop and wait protocol. Here we send a packet and from other end it sends an acknowledgement for this there are some transmission d delay and inefficiency.
Stop and Wait Automatic Repeat Request
ARQ (Automatic Repeat Request) – If a sender sends a data and the packet is lost then the receiver won’t send the acknowledgement at all and the system will get into a deadlock. In order to break the deadlock we use a Timeout Timer and if no acknowledge comes in the that time we resend the packet again.
Duplicate Packet Problem – If the acknowledgement is lost and then the sender will again assume that the data is lost and the sender will resend the packet and receiver will re process it. In order to overcome the problem we use sequence number to the data.
Missing Packet Problem – If the sender sends a packet p1 and the acknowledgement A got delayed for that sender again sends the packet p1 and got the acknowledgement A then it sends packet p2 and the packet got lost but the first acknowledgement for p1 got arrived now the sender will think that the packet p2 got send successfully. In order to solve the problem we use a acknowledgement number.
Some time the sender may send a lot of data and the receiver may not that much capable of handling the data.
So the here the sender first send one data packet and wait for a particular time the acknowledgement from the receiver.
If the acknowledgement comes in that time or before time then good.
Otherwise the sender then automatically resend the data.
When the receiver receives the packet it send acknowledgement for the next packet(not the packet that was received.)
In this method there is only one packet the channel always so the when a packet is sent successfully we can reuse the sequence number of that packet again.
Total Time – Tt + 2 * Tp [Tt = Transmission time for data, Tp = Propagation time]
Efficiency(η) – 1 / 1 + 2a [a = Tp / Tt]
Throughput or Effective Bandwidth or Bandwidth Utilization – η * B [η = Efficiency, B = bandwidth]
State – It is the session data that is been generated at the time of a client connects to a server.
Stateful – In stateful architecture let’s imagine a scenario of a eCommerce website that has 3 servers and there are 3 user connected to three servers and all the user session is store in the servers accordingly. Now let’s imagine a scenario of one of the three server goes down and all the state information about the users that were associated with it also lost. Now all that users have to do all the process again after establishing connection to a new server. So that’s a big issue in scalability and availability.
Stateless – In stateless architecture all the state information about the client is been stored in the shared storage connected to all the servers. Now let’s suppose a server goes down and and because all the state information is shared so if a client establish a connection with new server all the state information can be restored from the shared storage.
In conceptual we are going stateless but basically the we cannot eliminate the state entirely. There must be some place we are storing the states. We call it shared storage.
In the routing table there is entry for all the sub networks present in a network. And as the network increase the size of the routing table also increase. For this the router combine multiple networks to form a bigger network.
IP addresses must be contiguous.
All network should be of same size(the size also should be 2^n).
The first network ID should be divisible by the size of the block(number of host).
Let’s see the IP address can form a supernet or not. Ans is yes they can. because-
All are contiguous.
All network of same size.
Total number of host is 4 * 2^8 then the first IP address is divisible.
We put all 1 in the place of Network ID and all 0 in the place of Host ID.
In classfull representation Every network used to get same amount of host regarding of the class of the network. But that is a waste in many cases where if a user need 2^14 host and buy the class B network then 49152 network are wasted. To counter this situation IANA came up with a new technique –
It is also a 32 bit number but it has a special number which represents the number of bit present in block ID.
Here the number of Host present in the network is 2^(32-n) or here 2^12.
All the IP addresses re contiguous. Means there can’t be any fragmentation.
Block size must be power of 2(2^n). If the block size is 2^5 then the Host ID will contain 5 bits and the Block ID will be 27 bits.
First IP address must be evenly divisible by the size of the block. Means the least significant part should always start with zeroes in Host ID.
Check whether 220.127.116.11 to 18.104.22.168 is a valid IP address block or not?
All the IP addresses are contiguous.
Total number of IP addresses in the Block = 16 = 2^4
1st IP address: 100.1.2.00100000 . Since, Host Id will contains last 4 bits and all the least significant 4 bits are zero. Hence, first IP address is evenly divisible by the size of the block.
Suppose our CIDR address is 22.214.171.124/25 means the host ID is 7 bit 20.30.40.00001010
So the network ID will be 20.30.40.00000000 . Now If I want to divide the network in 2 part I will need to use 1 bit from the host ID. So the total ID part is now 26. 1st part : starting address is 20.30.40.00000000(126.96.36.199/26) & the direct broadcast address is 20.30.40.00111111(188.8.131.52/26).
2nd Part : Starting address is 20.30.40.01000000(184.108.40.206/26) & the direct broadcast address is 20.30.40.01111111(220.127.116.11/26). Same as if we wanted to divide the network in 4 parts we will have we will have ID part will be 27.
Sending some data from one host to another host is called casting. There are three type of casting –
Unicast – When we are sending message from one host to one host. The packet consist of | data | Source Address | Destination Address |
Limited Broadcasting – When a host want to send a packet to everyone in the same network then it use Limited Broadcasting. The packet consist of | data | Source Address | 255.255.255.255 |
Direct Broadcasting – When we are sending a message from one host of one network to all the host of other network then we use Directed Broadcasting. The packet consist of | data | Source Address | 18.104.22.168 |
Multicast – Transmitting data from one source host to a particular group of hosts that are interested in receiving the data is called Multicast. It is also called one to many transmissions.
When a bigger network is divided into sub network to maintain security is called subnetting. In order to divide the network into two parts you need select 1 bit from 8 bit of the host ID part.
The above network is class C network and the NID is 22.214.171.124 and we divide the network into two parts. Subnet 1 = we get the range 193.1.2.00000000(126.96.36.199) – 193.1.2.01111111(188.8.131.52). Here the 184.108.40.206 is the subnet ID and 220.127.116.11 is the Direct Broadcasting address. Subnet 2 = we get the range 18.104.22.16800000(22.214.171.124) – 126.96.36.19911111(188.8.131.52). Here the 184.108.40.206 is the subnet ID and 220.127.116.11 is the Direct Broadcasting address.
Suppose we divide a Class C network with 4 subnets. So in order to identify which packet belongs to which network we use subnet mask. It is a 32 bit number consist of 0 & 1. 1 = Network ID & Subnet ID 0 = Host ID So, for a IP address 18.104.22.168 the Subnet Mask is –
So, to identify which IP belongs to which subnet use use bitwise and operation on the subnet mask and the IP address.
When we type google.com in our web browser it is converted into IP addresses and then it reach to the desired google network and host and specific port to get the web page.
An IP address consists of two part –
The size of IP address is 32 bit.
1st Gen – In 1980 the IP address was divided into 8 bit or Network ID and 24 bit of Host ID but as people starts using computer more the requirement got more.
Classful System – We have divided the IP address into various classes –
Class A we take the first bit, Class B we take the first 2 bit, similarly in Class C we take the first 3 bit and so on till Class E.
Host per Network
1 + 7
2 + 14
3 + 21
Reserved For Multicast
Reserved For Experiment
What is dotted decimal representation?
If we divide the IP address in four parts(8 bits) and we convert the 8 bit into decimal and we put “.” in between it is called dotted decimal representation. e.g. – 127.0.0.1
Note : We can configure total (number of host – 2) per network.
suppose we have a network 22.214.171.124, 126.96.36.199. Whenever there is all 0 in the host ID it represents the network itself. That’s why we don’t use first IP address as a valid IP address for a host.
255.255.255.255 is assigned as Limited Broadcast Address. So it can’t be assigned to any host.
255 as host ID is assigned as Direct Broadcasting Address. So it can’t be assigned to any host. e.g – (NID).255.255.255
What is DNS overhead?
For converting the domain name into IP address we go to DNS(Domain Name Service) Server of the ISP(Internet Service Provider) and if it doesn’t know the IP then there are three hierarchy servers that helps –
TLD Server(Top Level Domain)
Actually we don’t do it every time we visit a website after conversion we store the IP address locally in our computer.
How a computer gets another computer’s MAC address in a LAN?
If there is two computer in a LAN suppose Computer A and Computer B and A wants to sends some data to the computer B over the LAN then it needs computer B’s MAC address to send the data. Let’s see how it works –
Computer A sends ARP(Address Resolution Protocol) request to all the machines in a LAN with the IP address of computer B.
Computer B respond on the ARP and sends back the MAC address.
DHCP (Dynamic Host Control Protocol)
Ever imagined when you connect to any wifi and it gives you a unique IP address automatically, How?
It is the protocol which gives IP addresses to host that joins a network and also manage the given IP addresses to the hosts.
There are four part of any DHCP system
DHCP Discover – When a new machine joins a LAN network it sends a broadcast message to to network to know the addresses of the DHCP server.
DHCP offer – After it gets a DHCP discover request from a host it sends a DHCP offer to the host with one IP address from it’s pull.
DHCP request – If the host accept the DHCP offer then it sends back a DHCP request back to the server.
DHCP Acknowledgement – Once the DHCP server gets the DHCP request it gives back a acknowledgement to the host and store the information.
E.G. – A typical example is our home router.
DHCP Relay – So big techs wants a specific DHCP server rather than the router in that case the router works as a DHCP relay and forwards the DHCP requests to the DHCP server knowing the destination IP address.
TCP/IP model stands for Transmission Control Protocol and Internet Protocol.
The TCP/IP model consists of five layers: the application layer, transport layer, network layer, data link layer and physical layer.
The first four layers provide physical standards, network interface, internetworking, and transport functions that correspond to the first four layers of the OSI model and these four layers are represented in TCP/IP model by a single layer called the application layer.
TCP/IP is a hierarchical protocol made up of interactive modules, and each of them provides specific functionality.
Below there is a table with all layers given with their individual task.
Allow access to network resources
Provides process to process message delivery and error handling
Move packets from source to destination
Responsible for transmission of data between two devices in a same network.
Here below a visual difference between OSI and TCP/IP protocol.
Note : The higher you go up in the model the headers are stripped away until you have the main data left for your application.
This layer is consist of different protocol like TCP or UDP. It has a thing called headers and the headers has certain properties as well –
Version – It describes the IP address type IPV4 or IPV6
Header Length – It specifies the size of the header. Usually it is 32 bit.
Differentiated Services Code Point (DSCP) – It contains data of bandwidth sensitive application like VOIP.
Time To Live (TTL) – Some time error happens and a Ip packets travels through the routers infinitely and to prevent we use this.
Protocol – It specifies the protocol type. E.G. – TCP or UDP.
It is a query language for the API in simple term. But what actually means and how it helps is a whole bunch of talk.
GraphQL is a syntax that describes how to ask for data, and is generally used to load data from a server to a client. GraphQL has three main characteristics:
It lets the client specify exactly what data it needs.
It makes it easier to aggregate data from multiple sources.
It uses a type system to describe data.
With GraphQL a user an make a single request and take all the data from the back-end rather than making a lot of request and it drastically reduce the server requests and improve performance. Below a sample query and the response.
For the past few decades we are using REST APIs and it was completely fine. But let’s see how it works.
In REST API there are specific endpoints for every resource that it needs and a client sometime have to make several requests to get a the actual data and also the data is sometime overloaded and sometime under loaded.
And the data is also store in different tables so you have to make different queries for different tables.
The YouTube page there are whole bunch of videos that comes up and in a REST architecture the YouTube make a request to the server to get all the IDs.
And then it again request back to get all the information about all the ID.
So for a million user the REST architecture is sending 2 request for this simple task.
But in a GraphQL architecture the data will comeback in a single request and there will also be specific.