Day1-100 series - Learning System Design for Interviews.

Day1-100 series - Learning System Design for Interviews.

Hello everyone, I am starting Day1-100 series on Learning System Design for Interviews.

ยท

3 min read

Day1 -> ๐Ÿ’œ LATENCY and THROUGHPUT ๐Ÿ’œ

Let's start,
In today's date, every system is online and is accessible to everyone across the globe. So Latency and Throughput becomes one of the most important factors to measure performance of any system.

๐Ÿ’โ€โ™‚๏ธ What is Latency ?
๐Ÿ‘‰ Latency is the measurement of time between request sent and response received by the system. In simple terms, when you open a website i.e. you send a request and then the delay taken for the response to arrive.
๐Ÿ‘‰ Latency measured in ms(milliseconds).
๐Ÿ‘‰ Low latency is always preferred over high latency. There are systems where low latency is compulsory like Online Video games and high latency always gives bad user experience.
๐Ÿ‘‰ Latency can be measured using ping test or there are many tools which can measure and record latency over a period of time.

๐Ÿ’โ€โ™‚๏ธ What is throughput ?
๐Ÿ‘‰ Over the networks, we send data using data packets. Now these data packets are like small chunks of bigger data. System takes those data packets and combine them back to create the bigger data. Hence that's why we see images on websites taking much more time to load instead of text because text data is smaller in size and image data.
๐Ÿ‘‰ Now, Throughput refers to the amount of data that can be transferred over a network in a period of time.
๐Ÿ‘‰ So, When data is transferred through networks, due to multiple factors, data packets are lost and system will request for them again and again till it gets complete data or it hits connection timeout.(Connection is broken when it hits timeout).
๐Ÿ‘‰ Throughput is measured in Mbps(megabit per second) or bps(bit per second).
๐Ÿ‘‰ There are lots of tools to measure throughput of a system like when you do speedtest on your browser that also simulates network traffic generators.

๐Ÿ”บ Remember throughput is affected by latency and bandwidth(the internet speed that you buy from your ISP). So we use tools as it gives throughput and latency separately.

๐Ÿ’โ€โ™€๏ธ Impacting factors for latency
๐Ÿ‘‰ Location : if your data has to travel long distance, latency will always be high.
๐Ÿ‘‰ Protocol efficiency : Depending on the network protocol, latency may differs such as TCP does 3 handshakes for making and breaking connections. So it creates a delay.
๐Ÿ‘‰ Infrastructure : if network infrastructures are overloaded, then data packets will be dropped, delayed adding it to latency.
๐Ÿ‘‰ Congestion : Network data packets is bound to take longer distance routes, when there is high volume of data transferred.

๐Ÿ’โ€โ™€๏ธ Impacting factors for Throughput
๐Ÿ‘‰ Bandwidth : If your network bandwidth is 1Gbps, you can send much more data packets in short amount of time resulting in less loss of data packets.
๐Ÿ‘‰ Network topology : Depending on number of devices connected, distance between devices plays a major role in throughput.
๐Ÿ‘‰ Packet loss : Misconfiguration, network overloaded and many more affects through put.
๐Ÿ‘‰ Processing Power : Certain network devices are specialized in handling complex data packets, or more optimized interms of data packets lost.

These are few factors that affect latency and throughput of system.

Hopefully, you may have enjoyed these. Do Follow and show some love.

Did you find this article valuable?

Support Tanisk's Blog by becoming a sponsor. Any amount is appreciated!

ย