DEV Community


Inefficient efficiency

mohanarpit profile image Arpit Mohan Originally published at ・2 min read

TL;DR notes from articles I read today.

Inefficient efficiency

  • Latency (measured in time units) is the time between a stimulus and a response, while throughput (measured in deliveries per time unit) is the rate at which the system meets its goals.
  • Sometimes latency and throughput interfere with each other. Do you field a request and respond before taking the next request (low latency for the first customer but overall lower throughput), or do you accept the second request while processing the first for higher throughput?
  • You make latency/throughput tradeoffs every day and most of us are biased towards throughput. For example - you carefully plan all foreseeable architectural improvements instead of initiating the first profitable change you come across.
  • Instead, you should optimize for latency. For example - if preferences are likely to change between requests (high rate of change), so you can adapt, which is less wasteful.
  • To decide between throughput and latency, consider the cost of delay, whether you might learn something that changes your approach subsequently, and whether external factors might force a new approach. 

Full post here, 4 mins read

Tips on API monitoring

  • Track your functional uptime with comprehensive, end-to-end testing for both functionality and performance. Simple ping tests are usually not enough to meet your service level agreements (SLAs).
  • Since 95% of API vulnerabilities are due to human error, add monitoring at 5-minute intervals for breaches and downtime. Integrate automated testing into every step of your CI/CD pipeline to filter out human errors and make sure you have load-testing capabilities too.
  • But you should beware of
    • tools that perform ‘synthetic testing’ and cannot reproduce actual consumer flows.
    • tools that use third-party clouds, adding another layer of insecurity to your API (have internal APIs use on-premise tools instead).
    • having separate testing and monitoring solutions.
    • tests that are not detailed enough for intelligent results.

Full post here, 4 mins read

Get these notes directly in your inbox every weekday by signing up for my newsletter, in.snippets().

Discussion (0)

Editor guide