Looks cool. Can you please remind me what this is doing? You detect when
physical memory is exhausted by noticing increased swap space usage? I
suppose one might get a similar effect by just setting the memoryuse
limit before running slapd, except that we would have to change the
behavior of ch_malloc and its callers.
The main goal of the adaptive caching is to make slapd's performance
robust to physical memory shortage as well as to make it benefit from the
low latency of the application-level entry caching. It enables autonomic
management of the degree of entry caching which can dynamically adapt to
changing availability of memory in the system. In addition, because of the
zone-based memory allocator, the performance behavior upon swapping (incl.
ones caused by other apps or underlying system) will be improved by much.
Look at http://www.openldap.org/conf/odd-sandiego-2004/Jonghyuk.pdf for
performance implication and early evaluation results.
The resource limit approach can be considered as a static approach whereas
the adaptive caching can be considered as a more dynamic management of
entry caching which can adapt to the changing system condition. In
addition, with the conventional malloc and resource limit approach, it
does not seem feasible to decrease the footprint of the entry cache
without writing them back to the swap device. With the zone-based memory
allocator, it is possible to yank the memory pages in the victim zone
upon memory shortage. The entry cache entries which were contained in
those pages can be reconstructed from the database when they are accessed
later.