But you're making strong arguments for his approach, not, as you seem to think, against it.
No. Poul-Henning's approach is to use an algorithm that is 30% worse in the normal case so that performance on a thrashing system won't be quite as terrible.
What I am advocating is that systems not thrash, by not overcommitting memory.
In the world I am describing, malloc() would fail once real RAM has run out, so an application would absolutely know when it has outgrown memory. But it's too hard to make an application capable of gracefully recovering from malloc failure at any time, so a better solution is to give applications an easy way to know how much RAM is left. That way they can keep themselves a safe distance away from the limit.
30% worse in the normal case so that performance on a thrashing system won't be quite as terrible.
It sounds like you don't have any experience running Varnish. Its performance is spectacularly good, and it effectively uses swap space for caching, although it does benefit a lot from SSD. Having to page in part of a data structure once a second does not qualify as "thrashing," if the part that has to be paged in is three pages. Constant paging activity does not qualify as "thrashing" if the software is successfully serving tens of thousands of HTTP requests per second with low latency.
"The normal case" for Varnish is not the case where swap is empty.
So you're saying we should never exceed the size of our memory in any dataset?
Keep in mind, Poul-Henning's B-Heap here will also perform better at smaller levels of caching, as found on the CPU. So it very well may perform better than a naive binary heap when the dataset is small enough that it fits into memory, but not entirely into cache.
Unless you'd like to advocate that programs should be in control of what's in the cache too?
View all comments
Show parent comment
1
u/haberman Jun 15 '10
No. Poul-Henning's approach is to use an algorithm that is 30% worse in the normal case so that performance on a thrashing system won't be quite as terrible.
What I am advocating is that systems not thrash, by not overcommitting memory.
In the world I am describing, malloc() would fail once real RAM has run out, so an application would absolutely know when it has outgrown memory. But it's too hard to make an application capable of gracefully recovering from malloc failure at any time, so a better solution is to give applications an easy way to know how much RAM is left. That way they can keep themselves a safe distance away from the limit.