Understanding API performance jargons
Power of 2
Memory allocation often uses sizes that are powers of 2 for efficiency. When handling large volumes of API data, memory management can be crucial, and using memory sizes that are powers of 2 can help optimize performance. To obtain correct calculations, it is critical to know the data volume unit using the power of 2. A byte is a sequence of 8 bits. An ASCII character uses one byte of memory (8 bits)
Example: Allocating 2^10 (1024) bytes of memory instead of 1000 bytes.
Latency
Latency refers to the time it takes for a data packet to travel from the source to the destination. Below are the few latency numbers that every CS guy should know:
Key Components of Latency:
Total latency is the sum of all these individual delays:
Total Latency = Propagation Delay+Transmission Delay+Processing Delay+Queuing Delay
Availability Numbers:
Availability numbers are metrics used to quantify the reliability and uptime of a system. High availability is the ability of a system to be continuously operational for a desirably long period of time. High availability is measured as a percentage, with 100% means a service that has 0 downtime. Most services fall between 99% and 100%.
Common Availability Metrics:
A service level agreement (SLA) is a commonly used term for service providers. This is an agreement between you (the service provider) and your customer, and this agreement formally defines the level of uptime your service will deliver. Cloud providers Amazon, Google and Microsoft set their SLAs at 99.9% or above. Uptime is traditionally measured in nines. The more the nines, the better.
Response time:
Response time refers to the amount of time it takes for a system to process a request and return a response to the client. It is a critical performance metric that affects the user experience and the perceived efficiency of the application.
Recommended by LinkedIn
Components of API Response Time:
Measuring API Response Time:
Response time is typically measured using tools and metrics such as:
Example:
If an API receives a request to fetch user details, the response time will include the time taken for:
Throughput:
Throughput is a key performance metric used to measure the amount of data processed by a system or network over a given period of time. It is particularly relevant in the context of APIs, networks, databases, and other data processing systems. Throughput is typically expressed in units such as requests per second (RPS), transactions per second (TPS), or bits per second (bps).
Key Aspects of Throughput:
Examples:
Relationship with Other Metrics:
References:
Engineering Manager | Full Stack | System Design | DSA
5moGreat post, Gaurav! You've nailed the key API performance jargons in an easy-to-digest way. The power of 2 concept is spot on for memory allocation efficiency, especially with large data volumes. Your breakdown of latency types is excellent, though a quick note on how physical distance between servers affects latency could add more depth. The explanation of availability numbers is clear and could benefit from real-world examples, like streaming services, to make it even more relatable. Response time is critical for user experience, and mentioning tools like New Relic for real-time monitoring would be a practical addition. Lastly, your take on throughput is perfect, and adding insights on scaling, both horizontally and vertically, could offer practical tips. Overall, a fantastic guide for understanding API performance. Keep sharing these valuable insights!
Frontend Engineer | React Developer| Next js Developer | Javascript Developer
5moReally good content !