Throughput vs. Latency and Lock-Free vs. Wait-Free
concurrencyfreaks.blogspot.com
concurrencyfreaks.blogspot.com
I'm still at "huh?" but things are clicking more. Would you elaborate on that statement?
I agree with the blog author's point that characterizing the entire latency distribution is more valuable than looking at an individual statistic, but it's difficult for me to understand how this blog post can say avoid talking about the equally important degree of parallelism. I'm probably a broken record, but I think Little's Law is one of the most under-utilized concepts in system analysis and design. http://web.mit.edu/sgraves/www/papers/Little's%20Law-Publish....
The chance of getting at least one p99 response out of a hundred is 1 - 0.99^100 ≈ 63%.
https://latencytipoftheday.blogspot.com/2014/06/latencytipof...
If you need X requests served for a full page-load (or whichever for the primary functionality of the page), you should be totaling those request times into a single entry for your histogram, otherwise you are calculating the distribution of something potentially useless (e.g. 50% of page_is_broken_without_it.js might actually be in p99 even if that file is 1% of your requests and the generic histogram might look deceptively good).
I think the blog author is on the right track to suggest that you at least need to look at the full distribution of the latencies. I'd go farther and say that if the metric you care about is total load time for a page with 100 components, lumping together all the individual component requests is probably never going to be able to provide all the information you actually need.
But as 'sp527' pointed out below, I may not have been precise enough in my use of "concurrency". From the Little's Law perspective I was emphasizing, we really care about the "number of requests in flight". But what constitutes a request depends on what we are measuring. If if each "page" consists of 100 pipelined HTTP requests, we probably need to define "in flight" as the number of simultaneous users we can support if we want to calculate the metric we actually care about.
I can see that throughput is an important measurement when you're trying to plan infrastructure, and concurrency is an important concept when you want to optimize it. but if I were to guarantee you <100ms latency for the next six months, you could drop your pen and take a vacation, right?
And why do you feel it's esoteric? I was trying to argue that the knowing the relationship between latency, throughput, and concurrency/parallelism is essential for proper design of just about any situation where performance is a concern. Rather than esoteric, I see it as fundamental --- although I suppose that depends on what one is trying to do.
(Can't wait for ruby->elixir transition to be complete. So far it seems to safe about 100ms).
"the inverse of the mean of the latency
distribution is [...] the throughput!
i.e. Little's Law?In the original article, this assertion is wrong except under special conditions that aren't described in the article. In computer systems you can have a latency of X and a throughput of Y, Z, or any number with no particular relation to X. Consider for example if I have a system with a throughput of 1000/s and a latency of 1ms, which satisfies the given relation but for no particular reason. Now suppose I add at the beginning of every request a 1-hour delay. Now my latency is 3600001ms, but my throughput is still 1000/s. The only thing that has changed is the number of requests in flight.
Number of requests in queue = latency * throughput
E.g., left hand side is a constant if you assume the system is fully utilized or constantly under max load.
The latency from the client to the backend is not really an issue so long as the request is processed at some point. In this situation, I'm looking at the throughput and cpu usage to see how far an instance can scale.
Am I missing something, or does latency not really play a large role in this particular scenario?
I don't think it's that simple. Unless the algorithm does something periodically and blows up tail latency - the one with better throughput might do better on tail latency as well, but under the same load, which is more important than latency under higher load, that it can handle.
> the one with better throughput might do better on tail latency as well, but under the same load, which is more important than latency under higher load, that it can handle.
If algorithm A performs worse at "the same load" than algorithm B, what sane benchmark is going to say algorithm A has better latency? Either there's a point where that ceases to be the case, or we can just say B has better latency and throughput.
And for latency, the worst var is what matters. With 10 occurrences per macro operation, about half of all operations will see 90 percentile latency at least once!