Hello everyone, I am starting Day1-100 series on Learning System Design for Interviews.
We will go from 0-100 in system design. If you want to learn system design follow and share, I will be posting everyday about system designs.
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.
Top comments (0)